Community
Participate
Working Groups
Consider the following program ------------------------------------------------------ class Tuple2<T1, T2> { static <T1, T2> Tuple2<T1, T2> tuple(T1 t1, T2 t2) { return new Tuple2<>(t1, t2); } } ------------------------------------------------------ I haven't written the constructor yet, but I'd like to have Eclipse generate it for me using quick fix. But it doesn't work - there is only an error message "Cannot infer type arguments for Tuple2<>". A workaround would be to explicitly set the generic type arguments prior to invoking quick fix: ------------------------------------------------------ class Tuple2<T1, T2> { static <T1, T2> Tuple2<T1, T2> tuple(T1 t1, T2 t2) { return new Tuple2<T1, T2>(t1, t2); } } ------------------------------------------------------
I'm using 4.5.0 M5, btw.
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.
With Eclipse 4.15.0, things got worse. I'm now no longer offered any quick fixes on the wrong code! When I remove the diamond operator... ------------------------------------------------------ class Tuple2<T1, T2> { static <T1, T2> Tuple2<T1, T2> tuple(T1 t1, T2 t2) { return new Tuple2(t1, t2); } } ------------------------------------------------------ I now get quick fix options, including the desired one to generate the constructor: ------------------------------------------------------ class Tuple2<T1, T2> { public Tuple2(T1 t1, T2 t2) { // TODO Auto-generated constructor stub } static <T1, T2> Tuple2<T1, T2> tuple(T1 t1, T2 t2) { return new Tuple2(t1, t2); } } ------------------------------------------------------ But now, with the removed diamond operator, I'm getting a rawtype warning, obviously. So I have to re-add the diamond operator.