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 248592

Summary: Undue hint about "unnecessary test for null"
Product: java Reporter: aquaglia <aquaglia>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P3    
Version: 8.0   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 249320    
Bug Blocks:    

Description aquaglia 2014-11-12 09:02:08 UTC
Product Version: NetBeans IDE 8.0.1 (Build 201408251540)
Updates: NetBeans IDE is updated to version NetBeans 8.0.1 Patch 1.1
Java: 1.8.0_05; Java HotSpot(TM) 64-Bit Server VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Windows 7 version 6.1 running on amd64; Cp1252; en_GB (nb)
User directory: C:\Users\quaglan\AppData\Roaming\NetBeans\8.0.1
Cache directory: C:\Users\quaglan\AppData\Local\NetBeans\Cache\8.0.1



In the following code:

ArrayList<INSPIREResourceRepresentation> resRepList = 
           INSPIREResourceRepresentation.fromXmlString(
                        transformer,
                        url,
                        containerFolder != null,
                        containerFolder,
                        false);

I get a warning about an "unneccesary check for null" regarding expression
containerFolder != null

What I mean with that code is to pass a boolean value:
(containerFolder != null ? true : false)
Comment 1 Svata Dedic 2015-06-02 13:50:07 UTC
Linking to an umbrella issue
Comment 2 Svata Dedic 2015-06-02 19:38:30 UTC
Hi; I tried to reproduce the issue and (on a simple example) it seems to work well. Please check the preceding code - if there's something like "containerFolder.xxx" (dereference of the containerFolder), the IDE assumes the containerFolder must not be null after this point.

If you're confident that the report is a false alarm, please try to create a sample which contains a whole method.