receiver annotations on a constructor
Alex Buckley
alex.buckley at oracle.com
Wed Jan 2 15:46:46 PST 2013
On 1/2/2013 3:34 PM, Jonathan Gibbons wrote:
> I'm looking at javadoc code for annotations on a receiver.
>
> Is it meaningful to talk about such annotations (on a receiver) for a
> constructor?
Yes. If the constructor is in an inner class, there are n receivers for
each of the n lexically enclosing instances of the object under
construction. Only the innermost receiver (the 1st lexically enclosing
instance) may be annotated due to a deliberate limitation in the 'this'
pseudo-parameter. In the spec at [1], see section 2.1 items 4 and 5 - it
is actually quite straightforward.
Alex
[1]
http://mail.openjdk.java.net/pipermail/type-annotations-spec-experts/2012-December/000046.html
More information about the type-annotations-dev
mailing list