Community
Participate
Working Groups
Created attachment 287184 [details] Compile error: Variable length argument + Method reference Eclipse IDE for Enterprise Java and Web Developers Version: 2021-09 4.21.0 Passing a method reference to a method with variable length arguments in a function interface will cause a compilation error. This happens regardless of the Java version of the project. This problem does not occur in Eclipse 2021-06 4.20. public static void main(String[] args) { String s1 = hoge1(String::new); String s2 = hoge2(String::new); // Error. See the attached file. } static <T> T hoge1(Supplier<T> sup) { return null; } static <T> T hoge2(Supplier<T>... sup) { return null; }
Error description: The target type of this expression must be a functional interface
Duplicate? bug 576152
(In reply to Shinji Kashihara from comment #2) > Duplicate? bug 576152 Most likely, however in your example there is no overloaded method.
*** This bug has been marked as a duplicate of bug 576152 ***