Bug 531056 - [quick fix] Add option to remove type arguments on constructor call
Summary: [quick fix] Add option to remove type arguments on constructor call
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.7.2   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-12 10:31 EST by Lukas Eder CLA
Modified: 2018-02-12 10:31 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Eder CLA 2018-02-12 10:31:10 EST
When I have the following logic:


------------------------------------------------
import java.util.ArrayList;
import java.util.List;

public class Diamond {
    List<Integer> list = new ArrayList<>();
}
------------------------------------------------

I can put my cursor in the diamond <> and there's a quick fix being offered, called "Insert inferred type arguments", which is great, and leads to this code:

------------------------------------------------
import java.util.ArrayList;
import java.util.List;

public class Diamond {
    List<Integer> list = new ArrayList<Integer>();
}
------------------------------------------------

Unfortunately, the inverse is not available. In the above logic, I'd like to be offered an option to remove this type argument again.

This would be a bit easier to do with more complex generic types, such as e.g. new HashMap<String, Map<Object, List<?>>>();, when selecting the type is a bit tedious.