Bug in encoding type annotations for supertype_targets
Joel Borggrén-Franck
joel.borggren.franck at gmail.com
Tue Feb 2 20:01:52 UTC 2016
Hi Alex,
On Mon, Feb 1, 2016 at 7:44 PM, Alex Buckley <alex.buckley at oracle.com> wrote:
> Yes, the reason I explicitly confirmed that the "Outer . @Foo Inner" terms
> were legal in source is because static nested types are in play, and they
> have tricky rules about what can be annotated and what can't. As you
> indicate, "@Foo Outer . Inner" would be illegal in source.
>
> I don't understand why you say this is a reflection issue when javac is
> consistently failing to emit the target_path item for annotated static
> nested types. Presumably javac is treating "@Foo Inner" as
> not-nested-in-Outer, but that's wrong from a class file and
> j.l.r.AnnotatedType point of view.
Only because in my experience this is how we usually did it. When the
spec and the compiler disagrees, the compiler usually wins. I think
encoding statically nested classes without a target_path is
technically viable since there is only one type that can be annotated,
thus core reflection can sort it out, even if it is complicated.
However given that type annotations never really worked perhaps it is
better to just fix the compiler in 9, which IMO is a better choice if
we can sidestep the compatibility issue.
cheers
/Joel
More information about the compiler-dev
mailing list