This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Names v. field access
- From: Ralph Loader <suckfish at ihug dot co dot nz>
- To: java at gcc dot gnu dot org
- Date: Wed, 01 Oct 2003 08:53:26 +1200
- Subject: Names v. field access
Hi,
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.
Ralph.
class temp
{
Object Foo()
{
return (java).util.Collections.EMPTY_LIST;
}
}