-encoding and -source in module-info.java

Jesse Glick jesse.glick at oracle.com
Tue Jan 24 16:25:50 PST 2012


On 01/24/2012 06:41 PM, Rémi Forax wrote:
> Nice to know that it works in Chrome and Xerces for UTF16,
> but it doesn't work with the parser used by my colleagues and
> provided by a lowly company of Redmond.

I am merely using the XML prolog example to point out that it is possible to sniff an encoding declaration out of a file using that same encoding, even for the obscure 
case of non-ASCII-superset encodings; XML parsers are not required to do so, since sometimes an encoding is specified out of band.

The cases are different technically because (1) XML defines no default encoding, whereas Jigsaw could and I think should, so a legal module-info.java not using UTF-8 must 
specify its actual encoding which makes detection easier; (2) the XML prolog is required to be the first bytes in the file, which makes detection easier, whereas this 
might be considered too ugly for module-info.java; (3) there would be one widely used reference implementation of the parser, namely javac, and that and other 
implementations must pass the same TCK which I would expect to test the corner cases.



More information about the jigsaw-dev mailing list