Community
Participate
Working Groups
BETA_JAVA8: The following program refuses to compile, while it should: // ---- public class X<T> { X<@Marker ?> l; class Y { void Y1(Y this) { } } } @java.lang.annotation.Target (java.lang.annotation.ElementType.TYPE_PARAMETER) @interface Marker { } Per EDR section 2.3: "ElementType.TYPE PARAMETER stands for a type parameter — that is, the declaration of a type variable. Examples are in generic class declarations class MyClass<T> {...}, generic method declarations <T> foo(...) {...}, and wildcards List<?>, which declare an anonymous type variable."
Fixed along with the fix for bug 391201 via commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=5aa22ef02c63418c06be6cd6a1ebf3ebbd649c6f
Jay, could you add a test for the following case please ? // --- public class X<@Marker T> { @Marker T t; T t2 = (@Marker T) null; } class X2<@Marker2 T> { @Marker2 T t; T t2 = (@Marker2 T) null; } @java.lang.annotation.Target (java.lang.annotation.ElementType.TYPE_USE) @interface Marker { } @java.lang.annotation.Target (java.lang.annotation.ElementType.TYPE_PARAMETER) @interface Marker2 { } // ---- We report 2 errors, javac reports 3. I think our behavior is correct - do you agree ?
(In reply to comment #2) > Jay, could you add a test for the following case please ? > ... > We report 2 errors, javac reports 3. I think our behavior is correct - do you > agree ? Yes, there should only be two errors. I have added new test to capture that. Here's the commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=4a9e81e0cc6daa6012c6270605219e05cb35a33d