| Summary: | [1.8][compiler] Type Annotations on wildcard type argument dropped. | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Srikanth Sankaran <srikanth_sankaran> | ||||
| Component: | Core | Assignee: | Andrew Clement <aclement> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | Flags: | srikanth_sankaran:
review+
|
||||
| Version: | 4.4 | ||||||
| Target Milestone: | BETA J8 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 409235 | ||||||
| Attachments: |
|
||||||
Andy, if you don't expect to get to this in the next 2-3 weeks, let me know. I'll reassign. TIA. Regression tests will be available via org.eclipse.jdt.core.tests.compiler.regression.JSR308SpecSnippetTests.test011() (to be released shortly). Created attachment 234646 [details] Fix and tests Test and fix. Might be easier to apply after the patch attached to bug 415543 (In reply to comment #3) > Created attachment 234646 [details] > Fix and tests Patch looks good. Thanks. For good measure I also updated org.eclipse.jdt.internal.compiler.ast.Wildcard.traverse(ASTVisitor, ClassScope) though I couldn't with minimal effort construct a test case that would prove the need for this change. Released here: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=ef77db37669242a4bac152127ea8ae67d10be39c This contribution complies with http://www.eclipse.org/legal/CoO.php |
BETA_JAVA8: From the spec: "An annotation on a wildcard type argument appears before the wildcard, as in MyClass<@Immutable ? extends Comparable<MyClass>>" However, when the following program is compiled, the annotations are accepted, but don't seem to make it to the class file: // --- import java.lang.annotation.*; import java.util.List; import static java.lang.annotation.ElementType.*; @Target(TYPE_USE) @interface Immutable {} class X { List<@Immutable ? extends Comparable<X>> x; } // ---- javac 8b100 emits: RuntimeInvisibleTypeAnnotations: 0: #9(): FIELD, location=[TYPE_ARGUMENT(0)]