spec clarification: type annotations on static nested types

Liam Miller-Cushon cushon at google.com
Tue Dec 11 02:14:19 UTC 2018


On Mon, Dec 10, 2018 at 2:57 PM Alex Buckley <alex.buckley at oracle.com>
wrote:

> To avoid confusion, the rule should be: "If the value of path_length is
> 0, and the type being annotated is a nested type, then the annotation
> applies to the outermost [DELETE]enclosing[/DELETE] part of the type for
> which a type annotation is admissible."  [I don't say "outermost
> component" because component is used in connection with array types.]
>

Thanks, I updated the bug.

"the type being annotated is a nested type" is much better than "the
annotation
appears on a nested type".

Does "outermost part of a type" refer to the idea of enclosing/nested types
in general,
or just in this specific context since we're only talking about nested
types?
Put another way, is it meaningful to talk about the 'outermost part' of
arbitrary
types?


> There's a certain "top-down" feel to this, which is unavoidable because
> a class file reader comes to type_path knowing the (say) parameter type
> which is being annotated, and wishing to know which part of the type has
> the annotation. 4.7.20.2 used to be like that -- "the top level type or
> any member type" -- but got itself turned around -- "the innermost
> member type and any enclosing ...".
>

Class reading might have felt more natural if type_path=0 applied to the
innermost nested type, and type_path_kind=1 was a step *outwards* to
the enclosing type. But there are trade-offs there. It looks like there was
some discussion of this (framed as "inside-out v. outside-in") in the
2012-11
type-annotations-spec-experts archives.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20181210/41190ce0/attachment.html>


More information about the compiler-dev mailing list