[type-annos-observers] Clarifying the receiver parameter (qualified 'this')

Markus Keller markus_keller at ch.ibm.com
Wed Oct 23 03:47:08 PDT 2013


In reply to Michael Ernst <mernst at cs.washington.edu>'s
http://mail.openjdk.java.net/pipermail/type-annotations-spec-experts/2013-October/000159.html

Yes, we're not at all questioning the "Outer.this" notation for inner 
class constructors.

I just find it awkward that the 308.pdf replaced 
java-annotation-design.html's
    [Identifier .] this
with
    {Identifier .} this
and allows (fully-)qualified 'this' expressions as the name of the 
receiver parameter even where that's not necessary.

The argument about analogy to qualified 'this' expressions in a method 
body is IMO too far-fetched, since the receiver parameter is closer to 
being a declaration rather than a reference. By the same argument, you 
would also have to allow other names in declarations to be redundantly 
qualified, e.g.:

    package my.pack;
    public class my.pack.Example { // illegal (good)
        my.pack.Example() { }  // illegal (good)
        void my.pack.Example.foo() { } // illegal (good)
        void bar(@Const Example my.pack.Example.this) { } // should be 
illegal
    }

Markus



More information about the type-annotations-spec-observers mailing list