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.

Bug 262212

Summary: Incapable to write lamda myself - need code completion
Product: java Reporter: Jaroslav Tulach <jtulach>
Component: EditorAssignee: Dusan Balek <dbalek>
Status: VERIFIED FIXED    
Severity: normal    
Priority: P3    
Version: 8.2   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 262230    

Description Jaroslav Tulach 2016-05-25 06:37:35 UTC
There are situations where writing lamda function is hard and it would be really nice to get code completion help. For example this method:

https://dukescript.com/javadoc/libs/net/java/html/lib/jquery/JQuery.html#addClass-net.java.html.lib.Function.A2-

isn't particularly easy to write:

JQuery q;
q.addClass(|

in a code like

import net.java.html.lib.Function;
import static net.java.html.lib.jquery.Exports.$;

public class Test {
    public static void main(String... args) {
        $("x").addClass(new Function.A2<Number, String, String>() {
            @Override
            public String call(Number p1, String p2) {
                return null;
            }
       });
    }
}

and generate the lamda automatically

import static net.java.html.lib.jquery.Exports.$;

public class Test {
    public static void main(String... args) {
        $("x").addClass((Number p1, String p2) -> null);
    }
}
Comment 2 Jaroslav Tulach 2016-05-26 08:47:17 UTC
Works like a charm. Thanks.