| Summary: | [1.8][compiler] Incorrect parsing of Annotations with array dimensions in arguments | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Manoj N Palat <manoj.palat> | ||||
| Component: | Core | Assignee: | Srikanth Sankaran <srikanth_sankaran> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | manoj.palat, shankhba, srikanth_sankaran | ||||
| Version: | 4.4 | ||||||
| Target Milestone: | BETA J8 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 413569 | ||||||
| Attachments: |
|
||||||
(In reply to Manoj Palat from comment #0) public class X { int bar(int [] @TakeType(int[].class)[] a) { return 0; } } @Target(ElementType.TYPE_USE) @Retention(RetentionPolicy.RUNTIME) @Documented @interface TakeType { Class value() default int[].class; } Note: there is a parameter "a" in bar. The modified test case inlined above. (In reply to Manoj Palat from comment #1) > Note: there is a parameter "a" in bar. The modified test case inlined above. Good catch, thanks. It helps always to provide a full test case that does not show any errors outside of what it is supposed to show. Here it is: Good catch. I'll take this one: Test case: import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; public class X { int bar(int [] @TakeType(int[].class)[] x) { return 0; } } @Target(ElementType.TYPE_USE) @Retention(RetentionPolicy.RUNTIME) @Documented @interface TakeType { Class value() default int[].class; } Fix and tests available here: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=af8e4657dabc36f9f429517d3e6a26c71037fd72 |
Created attachment 235645 [details] Test code to reproduce the issue ArrayTypeReference generated for argument is incorrect. Expected: int [] @TakeType(int[].class) [] Actual: int @TakeType(int[][].class) [] (only 1 dimension shown in actual, while the 2nd dimension is shown as part of annotations).