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 248360 - "Dereferencing possible null pointer" hint after Objects.nonNull check
Summary: "Dereferencing possible null pointer" hint after Objects.nonNull check
Status: RESOLVED DUPLICATE of bug 249320
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0.1
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords: JDK_8
Depends on:
Blocks:
 
Reported: 2014-11-03 11:29 UTC by keks
Modified: 2014-12-12 12:18 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 keks 2014-11-03 11:29:50 UTC
Product Version = NetBeans IDE 8.0.1 (Build 201408251540)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.8.0
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.0-b70

The newer functions of the Objects class (like Objects.nonNull(Object obj) or Objects.isNull(Object obj) seem to be ignored and a "Dereferencing possible null pointer" hint is shown when trying to access a field that has just been checked.
Example:
MyType myVar = someOperationsResult();
if (Objects.nonNull(myVar)) { // returns "obj != null;"
	myVar.doSomething(); // only gets executed if myVar != null yet the hint shows up
 }
I'm guessing it's sort of a dublicate of https://netbeans.org/bugzilla/show_bug.cgi?id=226083
Comment 1 Svata Dedic 2014-12-12 12:18:48 UTC

*** This bug has been marked as a duplicate of bug 249320 ***