Skip to content

Multi Generics and iterable type evaluation #12

Description

@zapl

There seems to be an issue with multi type generics:

Map<String, Integer> map = new HashMap<>();
map.entrySet().for

results in illegal code - , java.lang.Integer> is missing

for (Entry<java.lang.String name : map.entrySet()) {

}

Also the evaluation of Iterable seems broken

class Foo<A, B> implements Iterable<Foo<A, B>> {
    @Override
    public Iterator<Foo<A, B>> iterator() {
        return null;
    }
}

Foo<String, Integer> foo = new Foo<>();
foo.for

completes to

for (String foo : foo) {

}

instead of

for (Foo<String, Integer> foo2 : foo) {

}

above is btw result of Luna's new "create enhanced for loop" quick fix, so it is implemented correctly there. Also noteworthy: the quick fix did avoid duplicate variable names by adding a "2" and it's never using java.lang....

SW versions

  • Eclipse IDE for Java Developers 4.4.1.20140925-1820
  • JDT Patch to enable Postfix completion in Luna (Required) 0.0.1.201411112213
  • JDT Postfix code completion 0.0.3.201411112213

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions