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 245370

Summary: missing case in dereferencing possible null pointer hint
Product: java Reporter: IrianR
Component: HintsAssignee: Svata Dedic <sdedic>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 8.0.1   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 249320    

Description IrianR 2014-07-03 10:34:39 UTC
Using the following code:

List test = null;
for (Object linkedDocumentData : test)
{
   //throws NPE not detected by hint.
}
test.add("NPE detected by hint");

The hint shows on the call to the .add method but not on the for loop.

It works as designed using different kinds of for loops, only the "enhanced" for loop breaks.
Comment 1 Svata Dedic 2015-09-11 14:32:52 UTC
Trivial fix for 8.1, keeping as a reference for the reimplementation. Jet-main#8a6eb4b6eeaa
Comment 2 Quality Engineering 2015-09-17 01:26:23 UTC
Integrated into 'main-silver', will be available in build *201509170002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/8a6eb4b6eeaa
User: Svata Dedic <sdedic@netbeans.org>
Log: #245370: inspect iterations as pointer dereferences