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

Summary: "Dereferencing possible null pointer" hint after Objects.nonNull check
Product: java Reporter: keks
Component: HintsAssignee: Svata Dedic <sdedic>
Status: RESOLVED DUPLICATE    
Severity: normal Keywords: JDK_8
Priority: P3    
Version: 8.0.1   
Hardware: PC   
OS: Windows 7 x64   
Issue Type: DEFECT Exception Reporter:

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 ***