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 - Incapable to write lamda myself - need code completion
Summary: Incapable to write lamda myself - need code completion
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks: 262230
  Show dependency tree
 
Reported: 2016-05-25 06:37 UTC by Jaroslav Tulach
Modified: 2016-05-26 08:52 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.