RFR: JDK-8198945: Invalid RuntimeVisibleTypeAnnotations for annotation on anonymous class type parameter

Liam Miller-Cushon cushon at google.com
Tue Jul 3 22:17:02 UTC 2018


On Tue, Jul 3, 2018 at 11:31 AM Werner Dietl <wdietl at gmail.com> wrote:

> 8198945/webrev.02 only creates the NEW annotation for @Foo(1), but not
> for @Foo(3), because the latter has an INNER_TYPE location.
> Maybe the right check is that old.position.location doesn't contain
> any TYPE_ARGUMENT ?
>

Good point. Do we also need to add an INNER_TYPE location to the NEW
annotation, since the synthetic anonymous class declaration is itself an
inner class? e.g. given:

class Other {}
class Outer {
  class Inner {
    public void f() {
      new @A Other() {};
    }
  }
}

Do we need an [INNER_TYPE, INNER_TYPE] location to indicate that the NEW
annotation is on the type Outer$Inner$1, not Outer or Outer$Inner?

This would involve creating INNER_TYPE entries corresponding to any
enclosing classes of the synthetic anonymous class declaration, and
ignoring INNER_TYPE entries on the supertype when propagating the
annotation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20180703/e26cf884/attachment.html>


More information about the compiler-dev mailing list