Community
Participate
Working Groups
In a scenario with generic classes and variadic arguments the java editor marks a line as error that the command line (jdk) java compiler (javac) does compile. It looks similar to e.g. 481649 but seems to be triggered by variadic arguments. The following Program reproduces the issue: import java.util.function.Function; import java.util.function.Predicate; public class GenericsBug<S> { public static interface MyInterface<U> {} public static class SubClass<U,V> implements MyInterface<V>{ public SubClass(Function<U,V> g, MyInterface<V>... i) { } } public static class OptSubClass<U> implements MyInterface<U> { public OptSubClass(String s, Predicate<U> p, MyInterface<U>... i) { } } public static class ParamClass<T> { public T getU() { return null;} } GenericsBug(MyInterface<S> in1, MyInterface<S> in2) { } public static class MySubClass extends SubClass<ParamClass<Boolean>,Boolean> { public MySubClass() { super(ParamClass::getU); } } public static void foo() { SubClass<ParamClass<Boolean>,Boolean> sc = new SubClass<>(ParamClass::getU); new GenericsBug<>(new MySubClass(), new OptSubClass<>("foo", t->t, sc)); } }; The instanciation of GenericsBug yields the error "Cannot infer type arguments for GenericsBug<>" It may also be reproduced with ecj standalone. -- Configuration Details -- Product: Eclipse IDE 4.21.0.20210910-1200 (org.eclipse.epp.package.jee.product)Installed Features: org.eclipse.jdt 3.18.900.v20210906-0500 Versioning Plugin: org.eclipse.platform 4.21.0.v20210906-0842
Still valid with I20220407-0240
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.