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 258868 - Invalid editor hint: deferencing possible null pointer.
Summary: Invalid editor hint: deferencing possible null pointer.
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.1
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-16 12:06 UTC by oluwasayo
Modified: 2016-04-20 12:09 UTC (History)
0 users

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 oluwasayo 2016-04-16 12:06:55 UTC
Product Version = NetBeans IDE 8.1 (Build 201510222201)
Operating System = Mac OS X version 10.11.3 running on x86_64
Java; VM; Vendor = 1.8.0_45
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.45-b02

Reproducibility: Happens every time

STEPS:
  * Create a method as follows:
  public String marshal(Date input) {
    try {
      return input == null ? null : new SimpleDateFormat(format).format(input);
    } catch (Exception ex) {
      return input.toString();
    }
  }

ACTUAL:
  IDE complains about the return statement in the catch block.

EXPECTED:
  Try block already ensures input can never be null beyond there so IDE should not complain
Comment 1 Svata Dedic 2016-04-20 12:09:24 UTC
Correct; no sane Exception can be thrown in case input == null (Errors can be thrown, but not Exceptions). Requires quite precise control flow analysis