TYPE_USE annotations on scoping constructs

Anna Kozlova anna.kozlova at jetbrains.com
Wed May 27 11:22:42 UTC 2020


Hi everyone,

javac accepts the following code:

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@interface Ann { }
class A<T> {}
public class App extends A<@Ann App.Data> {//<--
    public static class Data { }
    public static void main(String[] args) {
    }
}

though fails to compile static List<@Ann App.Data> l;

Looks like A<@Ann App.Data> should also be a compile error?

Thanks,
Anna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20200527/56fba3ee/attachment-0001.htm>


More information about the compiler-dev mailing list