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 254593 - [81cat] The hint use equal with null check is not displayed for Strings.
Summary: [81cat] The hint use equal with null check is not displayed for Strings.
Status: RESOLVED INVALID
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.1
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-21 12:36 UTC by -Silver-
Modified: 2015-08-27 08:46 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (144.88 KB, text/plain)
2015-08-21 12:36 UTC, -Silver-
Details

Note You need to log in before you can comment on or make changes to this bug.
Description -Silver- 2015-08-21 12:36:48 UTC
Product Version = NetBeans IDE Dev (Build 201508210002)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.8.0_60-ea
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.60-b23

1) Create a class with this method.

public void method3(String s1, String s2) {
    if(s1=="") {}
}

2) Check that in the Options -> Editor -> Hints  all the hints of the group "General" are activated.

Expected result:
The line   if(s1=="") {}  should have 2 hints "Use equal with null check" and "Use equals and invert operands"

Actual result:
The line    if(s1=="") {}   shows only one hint  ("Use equals and invert operands")
Comment 1 -Silver- 2015-08-21 12:36:54 UTC
Created attachment 155527 [details]
IDE log
Comment 2 Svata Dedic 2015-08-27 08:46:25 UTC
I've checked the hint logic, to be sure :)

Actually the behaviour is not a bug, if you use the hint with default settings: by default, the string comparison hints try to get the literal first, which allows to call directly equals and not null-safe equals.