Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345359 - [1.7][compiler] AIOOB on diamond construct with argument error
Summary: [1.7][compiler] AIOOB on diamond construct with argument error
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7.1   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-10 23:27 EDT by Srikanth Sankaran CLA
Modified: 2011-08-05 02:54 EDT (History)
2 users (show)

See Also:


Attachments
Proposed patch (2.60 KB, patch)
2011-05-11 01:46 EDT, Srikanth Sankaran CLA
no flags Details | Diff
Proposed patch (2.71 KB, patch)
2011-05-11 02:02 EDT, Srikanth Sankaran CLA
no flags Details | Diff
Additional fix + test (4.30 KB, patch)
2011-05-12 02:26 EDT, Srikanth Sankaran CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Srikanth Sankaran CLA 2011-05-10 23:27:00 EDT
Top of BETA_JAVA7 branch.

The following code triggers an AIOOB from the compiler.


public class X<T>  {
    X(T t) {}
    X<String> f = new X<>(new Y()); 
}

(Y needs to be undefined to trigger the error)
Comment 1 Srikanth Sankaran CLA 2011-05-11 01:46:16 EDT
Created attachment 195297 [details]
Proposed patch

Patch under test
Comment 2 Srikanth Sankaran CLA 2011-05-11 01:46:50 EDT
Added org.eclipse.jdt.core.tests.compiler.regression.GenericsRegressionTest_1_7.test0029()  as a regression test.
Comment 3 Srikanth Sankaran CLA 2011-05-11 02:02:18 EDT
Created attachment 195299 [details]
Proposed patch

Actually, I like this patch better.
Comment 4 Srikanth Sankaran CLA 2011-05-11 04:27:19 EDT
Released in BETA_JAVA7 branch.
Comment 5 Srikanth Sankaran CLA 2011-05-12 02:10:35 EDT
I meant to fix QAE in a similar manner, but forgot:

Now the following program continues to trigger AIOOB:


public class X {
    class I<T> {
	I(T t) {}
    }
    X.I<String> f = new X().new I<>(new Y()); 
}

Patch will follow shortly.
Comment 6 Srikanth Sankaran CLA 2011-05-12 02:26:56 EDT
Created attachment 195460 [details]
Additional fix + test

This patch addresses QAE. Other subtypes of AllocationExpression will
undergo similar change via bug 343693.
Comment 7 Olivier Thomann CLA 2011-06-28 10:09:03 EDT
Verified using v_B65.