This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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;
    }
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]