Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 268089 - code hints get confused by lambda expressions
code hints get confused by lambda expressions
Product: java
Classification: Unclassified
Component: Hints
All All
: P2 (vote)
: Dev
Assigned To: Svata Dedic
Depends on:
  Show dependency treegraph
Reported: 2016-09-18 23:26 UTC by athompson
Modified: 2016-09-20 19:19 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT

incorrect code hint shown (136.37 KB, image/png)
2016-09-18 23:26 UTC, athompson

Note You need to log in before you can comment on or make changes to this bug.
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
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 (upload may still be in progress)

User: Svata Dedic <>
Log: #268089: do not descend into lambda expr
Comment 8 athompson 2016-09-20 19:19:29 UTC
Yup. Thanks!

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo