javac bug re: name of receiver parameter

Alex Buckley alex.buckley at oracle.com
Thu Oct 24 17:08:46 PDT 2013


Hi list, another small discrepancy to report:

The longstanding java-annotation-design.pdf file gave the grammar of a 
receiver parameter as:

   Type [Identifier .] this

so that an inner class's constructor can name its receiver parameter as 
"Outer.this". A deeply qualified name like 
"pkg1.pkg2.FarOuter.Outer.this" was syntactically impossible.

Unfortunately, javac accepts deeply qualified names. Admittedly, they 
were permitted in the JLS/JVMS draft for a couple of months, where the 
grammar was given as "{Identifier .} this".

Regardless, the 308 Expert Group has now determined that "[Identifier .] 
this" should prevail, as in java-annotation-design.pdf, so javac should 
accept only "this" and "/Identifier/ . this" as the name of a receiver 
parameter. The type of a receiver parameter continues to be as simple or 
as qualified as the programmer wishes.

Alex


More information about the type-annotations-dev mailing list