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 225970

Summary: False unnecessary null test hint
Product: java Reporter: gualtiero65
Component: HintsAssignee: Jan Lahoda <jlahoda>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 7.3   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Attachments: IDE log
Netbeans screen shot
Class source file

Description gualtiero65 2013-02-11 09:25:50 UTC
Product Version = NetBeans IDE 7.3 RC2 (Build 201302050851)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_13
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.7-b01

The "unnecessary null test" hint is unfluenced by the @javax.annotation.Notnull annotation.
The following code:

public void showBug2(@javax.annotation.Nonnull String str) {
        assert str != null;
        ..............

generates a false hint message on the assert line while it should not.
By removing the annotation on the str parameter, the hint message disappears.
Comment 1 gualtiero65 2013-02-11 09:26:05 UTC
Created attachment 131227 [details]
IDE log
Comment 2 gualtiero65 2013-02-11 09:28:57 UTC
Created attachment 131228 [details]
Netbeans screen shot

The image show the flase message hint on the second method while the first one, without annotation, does not have any hint messages.
Comment 3 gualtiero65 2013-02-11 09:30:00 UTC
Created attachment 131229 [details]
Class source file
Comment 4 Quality Engineering 2013-06-22 02:08:53 UTC
Integrated into 'main-golden', will be available in build *201306212301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/af654455806b
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #225970: making null pointer check ignore precondition checks.
Comment 5 Jan Lahoda 2013-06-22 05:28:09 UTC
The check should be ignoring typical "precondition checks" after the above changeset.