Bug in encoding type annotations for supertype_targets

Alex Buckley alex.buckley at oracle.com
Tue Feb 2 20:06:44 UTC 2016


Hi Joel,

On 2/2/2016 12:01 PM, Joel Borggrén-Franck wrote:
> 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.

Absolutely agree that it's best to fix javac (rather than Core 
Reflection) in JDK 9.

Alex


More information about the compiler-dev mailing list