eclipse-jdt / eclipse-jdt/eclipse.jdt.core

[content assist] Map.get() should use generic type information to limit the suggestions

Open
#998 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

This originated from https://bugs.eclipse.org/bugs/show_bug.cgi?id=572611, but was slightly modified here:

The content assist for Map.get() should use type information for the parameter. I'm aware that Java does not have reified generics, but in the IDE this information should be available.

Consider:
```
public static void test() {
Double twoDotOne = 2.2;
Exception ex = new Exception();
String a = "a";
Integer one = 1;

Map intToString = new HashMap<>();
Map stringToInt = new HashMap<>();

intToString.put(one, a);
stringToInt.put(a, one);

String result = intToString.get( position Eclipse should show "one" as the first suggestion.

No idea if this is a feature request or a bug.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.