Names v. field access

Andrew Haley aph@redhat.com
Tue Sep 30 22:30:00 GMT 2003


Ralph Loader writes:
 > 
 > Reading the java language spec, I think the code below is invalid, but
 > both gcj and sun's javac accept it.
 > 
 > According to the grammar, a package name or class name cannot contain
 > parenthesis.  (java).util is a field access on the primary (java), and
 > this should therefore be an error as there is no variable or field
 > called java.
 > 
 > http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#41267
 > appears to be explicit about this.
 > 
 > Is that analysis correct?  Should we follow what sun says or what sun
 > does?  There's a few bugs listed on sun's website about incorrectly
 > accepting extraneous parenthesis, but I couldn't see this one.

My feeling is that we should not be stricter than Sun unless we really
need to be.  But I have never seen anything like this before, so I
don't think it would adversely affect anyone.

Andrew.



More information about the Java mailing list