Description
Test case: Foo has @Target with all ElementType enum constants and FooContainer does not have @Target.
Based on this rule, the above test case should compile:
If an annotation is not meta-annotated with @Target, then the compiler treats the annotation as if it is meta-annotated with all of the ElementType enum constants that appear in Java 7: ANNOTATION_TYPE, CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, and TYPE
Expected: code should compile fine.
Actual behavior: Compiler error:
NoTargetonContainer.java:9: error: target of container annotation FooContainer is not a subset of target of repeated annotation Foo
@ContainedBy(FooContainer.class)
^
1 error
Test src code attached.
Based on this rule, the above test case should compile:
If an annotation is not meta-annotated with @Target, then the compiler treats the annotation as if it is meta-annotated with all of the ElementType enum constants that appear in Java 7: ANNOTATION_TYPE, CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, and TYPE
Expected: code should compile fine.
Actual behavior: Compiler error:
NoTargetonContainer.java:9: error: target of container annotation FooContainer is not a subset of target of repeated annotation Foo
@ContainedBy(FooContainer.class)
^
1 error
Test src code attached.
Attachments
Issue Links
- relates to
-
JDK-7195131 Update 2 compiler combo tests for repeating annotations to include package and default use cases
-
- Closed
-
-
JDK-8007766 Repeating annotations: No Target on base with two new targets on container compiles unexepectedly
-
- Closed
-