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 268089

Summary: code hints get confused by lambda expressions
Product: java Reporter: athompson <athompson>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: VERIFIED FIXED    
Severity: normal CC: athompson
Priority: P2    
Version: Dev   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: incorrect code hint shown

Description athompson 2016-09-18 23:26:50 UTC
Created attachment 162104 [details]
incorrect code hint shown

See the attached screenshot. In this case, the variable `nextRunTime` can clearly be NULL if the method `getNextRunTime` returns NULL.

The issue seems to be the closure/lamda I'm supplying as a parameter to the method. If I replace it with an anonymous inner class hints behave correctly.
Comment 1 athompson 2016-09-18 23:34:08 UTC
*lambda
Comment 2 Jiri Kovalsky 2016-09-19 07:18:16 UTC
Can you please evaluate this problem ASAP? Thanks!
Comment 3 Jiri Kovalsky 2016-09-19 07:22:12 UTC
Does this happen in development build only or also in 8.2 Release Candidate?
Comment 4 Svata Dedic 2016-09-19 07:37:11 UTC
Confirmed; generally these types of defect are classified P3. 

The NPE analysis code is quite complex; unless the fix is something very trivial (will investigate) I would not recommend fixing this issue in high resistance.
Comment 5 Svata Dedic 2016-09-19 07:49:10 UTC
Update: the defect is in a shared utility, so it potentially affects also if-to-switch conversion, Introduce Method and possibly may produce false warnings on expressions/values unused afer assignment.
Comment 6 Svata Dedic 2016-09-19 08:38:03 UTC
Fixed in trunk by jet-main#15ecebefc019
Comment 7 Quality Engineering 2016-09-20 02:38:08 UTC
Integrated into 'main-silver', will be available in build *201609200002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/15ecebefc019
User: Svata Dedic <sdedic@netbeans.org>
Log: #268089: do not descend into lambda expr
Comment 8 athompson 2016-09-20 19:19:29 UTC
Yup. Thanks!