This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
The following code is flagged with an error by NetBeans despite that it compiles fine. The classes pasted must be in separate files, otherwise the bug will not manifest itself: public class MyTestContainer { public void setEntry(MyTestEntryFactory entryFactory) { } } public interface MyTestEntry { public <DataType> void doSomething(); } public interface MyTestEntryFactory { public MyTestEntry create(); } public class MyTest { public static void test() { MyTestContainer container = new MyTestContainer(); container.setEntry(() -> { return new MyTestEntry() { @Override public <DataType> void doSomething() { } }; }); } } The line containing "container.setEntry" is flagged as an error with the message: "The type of setEntry(MyTestEntryFactory) is erroneous". Workaround: Casting the lambda explicitly to MyTestEntryFactory solves the issue. Another issue in this code (though it might be unrelated) that the anonymous class implementing MyTestEntry is flagged to be convertible to lambda which is not true because doSomething() has a generic argument.
Fixed in jet-main. http://hg.netbeans.org/jet-main/rev/21a01aaf51f7 http://hg.netbeans.org/main/nb-javac/rev/f453b3a76796
Integrated into 'main-silver', will be available in build *201706280001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/21a01aaf51f7 User: Dusan Balek <dbalek@netbeans.org> Log: Issues #269459 and #270849 fixed.