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 251229 - Incorrect NetBeans Java hint for instanceof
Summary: Incorrect NetBeans Java hint for instanceof
Status: RESOLVED FIXED
Alias: None
Product: third-party
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 8.0.2
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: issues@third-party
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-17 09:29 UTC by gooddreams
Modified: 2015-03-30 14:21 UTC (History)
1 user (show)

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 gooddreams 2015-03-17 09:29:16 UTC
Product Version = NetBeans IDE 8.0.2 (Build 201411181905)
Operating System = Mac OS X version 10.9.5 running on x86_64
Java; VM; Vendor = 1.8.0_20
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.20-b23

Recently I updated NetBeans (updated some modules automatically), today I noticed it now show warning on all "instance of" conditions.
For example:
if (o instance of BigDecimal) {
    return (BigDecimal) o;
}
The warning (NetBeans hint) as below:
Dead instanceof. Object cannot be assigned to BigDecimal
----
(Alt-Enter shows hints)
Comment 1 gooddreams 2015-03-17 09:40:53 UTC
sorry, example code is:
if (o instanceof BigDecimal) {
    return (BigDecimal) o;
}
Comment 2 airdrik 2015-03-26 14:14:24 UTC
I can confirm this, using Netbeans 8.0.2 on Ubuntu Linux 14.04, using Oracle java 7, all x86_64.
The hint is flagging instanceof statements where the instance under test is an Object, or at least is a Supertype of the class being tested.
Comment 3 airdrik 2015-03-26 14:30:30 UTC
I checked the github repository for the hints plugin: https://github.com/markiewb/nb-additional-hints, and found that this bug was already submitted (issue #50 on github) and fixed in versions 1.4.1.1 and 1.5 of the nb-additional-hints plugin.

I updated the plugin to 1.5 and no longer see the false-positives.
Comment 4 Svata Dedic 2015-03-30 14:21:15 UTC
According to comment #3, marking as fixed (in the 3rd party plugin)