| Summary: | [1.8][compiler] Incorrect bound index in RuntimeInvisibleTypeAnnotations attrribute | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Srikanth Sankaran <srikanth_sankaran> | ||||
| Component: | Core | Assignee: | Andrew Clement <aclement> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | ||||||
| Version: | 4.4 | ||||||
| Target Milestone: | BETA J8 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 409235 | ||||||
| Attachments: |
|
||||||
Andy, please follow up, TIA. Regression test available via: org.eclipse.jdt.core.tests.compiler.regression.JSR308SpecSnippetTests.test034() (which will have to be massaged). Created attachment 234639 [details] Fix and test for bug I couldn't find the test you referenced (didn't seem to be in there) so I created one using the code embedded in the bug and I also added another that tested a few more variants and tested the method type parameter case. Recommend applying patch for bug 415541 first (just to simplify merging) (In reply to comment #2) > Created attachment 234639 [details] > Fix and test for bug > > I couldn't find the test you referenced (didn't seem to be in there) so I > created one using the code embedded in the bug and I also added another that > tested a few more variants and tested the method type parameter case. Thanks, I had forgotten to release the test I had in my workspace. Sorry. Patch looks good. Released here: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=7089fcfd703b096f125599a900905c00e15535fa This contribution complies with http://www.eclipse.org/legal/CoO.php |
BETA_JAVA8: ---------- From the spec: "When the annotation’s target is a bound of a type parameter of a class or method, target info contains one type parameter bound target: type_parameter_bound_target { u1 type_parameter_index; u1 bound_index; }; type parameter index specifies the index of the type parameter, while bound index specifies the index of the bound. Indexes start at 0. Bound index 0 is always a class, not interface, type. If the programmer-supplied upper bound of the type variable is an interface, it is treated as the second bound, and the implicit first bound is java.lang.Object. // --- Given that, given the following program: // --- import java.lang.annotation.*; import static java.lang.annotation.ElementType.*; @Target({TYPE_USE}) @interface NonNull { } class X <T extends @NonNull Comparable> { } // -- we generate bad code: " RuntimeInvisibleTypeAnnotations: \n" + " #21 @NonNull(\n" + " target type = 0x11 CLASS_TYPE_PARAMETER_BOUND\n" + " type parameter index = 0 type parameter bound index = 0\n" + " )\n" + "}" javac 8b100 generates: RuntimeInvisibleTypeAnnotations: 0: #13(): CLASS_TYPE_PARAMETER_BOUND, param_index=0, bound_index=1 which is correct.