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 240945 - Dereferencing possible null for autoboxing
Summary: Dereferencing possible null for autoboxing
Status: RESOLVED FIXED
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-01-25 04:04 UTC by _ gtzabari
Modified: 2015-11-18 10:48 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2014-01-25 04:04:17 UTC
Netbeans should issue the same "dereferencing possible null" warning for autoboxing as it does when dereferencing other values that may be null.

Meaning:

String value = possiblyNull.toString(); // issues a warning
int value = getInteger(); // missing a warning because the Integer may be null
Comment 1 Svata Dedic 2015-11-18 10:48:58 UTC
Fixed in the experimental impl, provided that getInteger() is annotated by @CheckForNull etc (or the return value is tested for null before it is assigned). Without an explicit comparison or annotation I cannot assume a reference return type is nullable - it would produce numerous errors. There will be a strict check option in the future.