Bug 353452 - [1.7][quick fix] Quick fix for explicit type arguments with diamond operator
Summary: [1.7][quick fix] Quick fix for explicit type arguments with diamond operator
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P5 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-30 02:56 EDT by Ayushman Jain CLA
Modified: 2011-08-02 16:01 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ayushman Jain CLA 2011-07-30 02:56:21 EDT
BETA_JAVA7

public class DiamondTest<T> {
	
	public <U> DiamondTest(T t) {
		
	}

	public static void main ( String[] args ) {
		DiamondTest<String> d = new <Integer> DiamondTest<>();

	}

}

On the error at <Integer> above, there can be a quick fix which inserts <String> in place of <>.

(Sorry if i'm filing a dup.)
Comment 1 Markus Keller CLA 2011-08-02 16:01:40 EDT
The RHS also needs an actual method argument (e.g. ""). Then the best fix would be to turn it into
    new DiamondTest<>("");
not
    new <Integer>DiamondTest<String>("");

I don't think we should spend time on this, since explicit constructor type arguments are rare in practice. In the given example, the compiler would first have to be fixed to compute the right type binding for the ClassInstanceCreation.