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 247939

Summary: sout doesn't work propertly in lambda
Product: java Reporter: Alexander Kouznetsov <mrkam>
Component: EditorAssignee: Dusan Balek <dbalek>
Status: NEW ---    
Severity: normal CC: johnjullion
Priority: P3    
Version: 8.0.1   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:

Description Alexander Kouznetsov 2014-10-14 23:19:05 UTC
Consider I have a DoubleProperty:

DoubleProperty property;

Then I want to add a listener that outputs its value. So I type:

property.addListener(o -> sout[tab]);

and press tab key where indicated.

Two results possible:
- By default I get nothing as I'm still inside the red border box (specifying parameters).
- If I has cancelled it, I'll get 

property.addListener(o -> System.out.println(""););

which is syntactically incorrect.

Expected result is as following, preferrably even when entered while inside the red box:

property.addListener(o -> System.out.println(""));
Comment 1 Jiri Prox 2014-10-17 07:53:47 UTC
Unfortunately the code templates are not smart enough to alter the inserted code according the current context. It only inserts the predefined code. 

You have to define new cote template without the ';'