Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 409517 - [1.8][compiler] Type annotation problems on more elaborate array references
Summary: [1.8][compiler] Type annotation problems on more elaborate array references
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.3   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: BETA J8   Edit
Assignee: Andrew Clement CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 409248 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-05-30 12:34 EDT by Andrew Clement CLA
Modified: 2013-08-16 08:02 EDT (History)
1 user (show)

See Also:


Attachments
Patch including tests and fixes (21.80 KB, patch)
2013-05-30 12:40 EDT, Andrew Clement CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Clement CLA 2013-05-30 12:34:48 EDT
The following styles of array references with type annotations need some work:

// inner types with multi dimensional arrays
@B AA.@A BB[] @C[] field;
Object o = new @B(1) Outer.@B(2) Inner @B(3) [2];
Object o = new @B(1) Outer.@B(2) Inner @B(3) [2] @B(4)[4];

// new multi dim array with initializer
X[][] x = new @A X @B [] @C[]{ { null }, { null } };

// new multi dim
X[][] x = new @A X @B [1] @C[2];

// new multi dim, not all dimensions specified
X [][][] x = new @A X @B[10] @C[10] @D[];

// fully qualified names when inner types and multi dim arrays in use
Object o = new org.foo.bar.@B(1) Outer.@B(2) Inner @B(3) [2] @B(4)[4];
Comment 1 Andrew Clement CLA 2013-05-30 12:40:00 EDT
Created attachment 231761 [details]
Patch including tests and fixes

Multiple new tests in TypeAnnotationTests for those problematic variants. Changes to Annotation such that it builds the type path correctly for these case and one small change in TypeAnnotationCodeStream to pass over the dimensions rather than just assuming 1.
Comment 2 Srikanth Sankaran CLA 2013-08-16 07:03:50 EDT
*** Bug 409248 has been marked as a duplicate of this bug. ***
Comment 3 Srikanth Sankaran CLA 2013-08-16 08:02:33 EDT
Fix and tests released via http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=cf1c51fea432a69f6f934132d762d7abff4de048.

While comparing the behavior of 8b100 javac, I can see quite a way instances
where javac is imprecise in code generation. Thanks for the extra care that
has gone into this effort, Andy.