You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Jan Lahoda (JIRA)" <ji...@apache.org> on 2018/03/29 05:20:00 UTC
[jira] [Resolved] (NETBEANS-407) "Dereferencing possible null
pointer" after doing instanceof on variable (false positive)
[ https://issues.apache.org/jira/browse/NETBEANS-407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jan Lahoda resolved NETBEANS-407.
---------------------------------
Resolution: Fixed
Assignee: Jan Lahoda
Fix Version/s: 9.0
Should be fixed by:
[https://github.com/apache/incubator-netbeans/commit/3bb6c7396a58ef75930148c30a3bb05baf0c06e6]
> "Dereferencing possible null pointer" after doing instanceof on variable (false positive)
> -----------------------------------------------------------------------------------------
>
> Key: NETBEANS-407
> URL: https://issues.apache.org/jira/browse/NETBEANS-407
> Project: NetBeans
> Issue Type: Bug
> Components: java - Hints
> Affects Versions: 8.2, 9.0
> Reporter: Eirik Bakke
> Assignee: Jan Lahoda
> Priority: Minor
> Labels: pull-request-available
> Fix For: 9.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> In the following example, the "boolean foo = k instanceof Integer" assignment causes a spurious "Dereferencing possible null pointer" warning to occur on the "k.doubleValue()" expression. I believe this did not happen in earlier NetBeans versions (pre-8.2). Note that if the assignment to "boolean foo" is replaced by an if statement ("if (k instanceof Integer)"), the warning goes away.
> {code:java}
> public class TestClass {
> private Number getFoo() {
> return 3;
> }
> public void testFoo() {
> Number k = getFoo();
> // The warning only occurs if this assignment is present.
> boolean foo = k instanceof Integer;
> // Warning on .doubleValue() here: "Dereferencing possible null pointer"
> System.out.println(k.doubleValue());
> }
> }
> {code}
> This bug was previously described at https://netbeans.org/bugzilla/show_bug.cgi?id=269324 .
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists