| Summary: | [1.7][quick fix] Quick fix for explicit type arguments with diamond operator | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Ayushman Jain <amj87.iitr> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | ASSIGNED --- | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P5 | CC: | daniel_megert, markus.kell.r |
| Version: | 3.7 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
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.
|
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.)