Summary: | Compile error: Variable length argument + Method reference | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Shinji Kashihara <kashihara> | ||||
Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> | ||||
Status: | CLOSED DUPLICATE | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | CC: | loskutov | ||||
Version: | 4.21 | Keywords: | regression | ||||
Target Milestone: | --- | ||||||
Hardware: | PC | ||||||
OS: | All | ||||||
See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=576152 | ||||||
Whiteboard: | |||||||
Attachments: |
|
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 *** |
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; }