Eclipse-Postfix-Code-Completion icon indicating copy to clipboard operation
Eclipse-Postfix-Code-Completion copied to clipboard

Multi Generics and iterable type evaluation

Open zapl opened this issue 11 years ago • 3 comments

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

zapl avatar Nov 20 '14 18:11 zapl

Thanks for the report. First issue is fixed in the latest build.

The second issue is a bit harder to fix in a clean way, but I hopefully can come up with a fix the next days.

trylimits avatar Nov 23 '14 22:11 trylimits

Nice, :+1: One thing regarding above commit: fäo.f$o.fo_o.F$oßo is a valid fully qualified class name according to https://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8 - you may want to expand your regex a bit.

zapl avatar Nov 24 '14 00:11 zapl

Thanks for the info. I really did not know that. Change is integrated in the today's build.

Evaluation of Iterable is still not fixed though. I guess this has to wait until my exams are over.

trylimits avatar Dec 09 '14 20:12 trylimits