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 - Undue hint about "unnecessary test for null"
Summary: Undue hint about "unnecessary test for null"
Status: RESOLVED WORKSFORME
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on: 249320
Blocks:
  Show dependency tree
 
Reported: 2014-11-12 09:02 UTC by aquaglia
Modified: 2015-06-02 19:38 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 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.