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 - sout doesn't work propertly in lambda
Summary: sout doesn't work propertly in lambda
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-14 23:19 UTC by Alexander Kouznetsov
Modified: 2014-10-17 07:53 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

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