[type-annos-observers] type closest to a type annotation
Markus Keller
markus_keller at ch.ibm.com
Fri Feb 7 03:19:19 PST 2014
Alex Buckley <alex.buckley at oracle.com> wrote on 2014-02-07 00:58:15:
> On 2/6/2014 8:58 AM, Markus Keller wrote:
> > BTW: Note that term "closest" in "the type which is closest to the
> > annotation" is not defined by the spec. Likewise, type annotations on
> > array types are only defined in an informal section.
> > "Closest" seems to mean something like "the next following type
reference
> > that is not in an other annotation (and not in a type parameter
> > declaration)".
>
> I don't think "closest" is terribly confusing, even with a type
> parameter section, but I agree the text can do better:
>
> "If the annotation's type is applicable in type contexts, and not in the
> declaration context corresponding to the declaration, then the
> annotation is deemed to apply only to _the type of the declared
entity_."
Then we better keep "closest". Counterexample:
@A int[] f;
"The type of the declared entity" here means "the type of variable 'f'",
which is "int[]", but the type annotation @A applies to "int".
But maybe you could add this sentence at the first occurrence of "closest"
in 9.7.4?
"The closest type is the lexically first type reference in the declared
entity's type."
Markus
More information about the type-annotations-spec-observers
mailing list