vscode-java icon indicating copy to clipboard operation
vscode-java copied to clipboard

be smarter on inferring types when collection type does not match

Open maxandersen opened this issue 2 years ago • 1 comments

I had this code first:

		final Map<String, String> messages = new HashMap<>();

Then changed it to:

		final List<Map<String, String>> messages = new HashMap<>();

Now vscode just complains about not being able to infer the right types and no quick fix available.

Given the left side explicitly says this needs to be a List not a Map derivative anymore could a quickfix not suggest to make it new ArrayList<>(); as a decent fix to make it compile ?

Similar would work for Set, Map, and other collection types.

maxandersen avatar Apr 03 '23 07:04 maxandersen

We'll need JDT-LS updated to at least I20240628-1800 ( to be built today) in the target file, to take advantage of the feature/API.

rgrunber avatar Jun 28 '24 16:06 rgrunber