Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 538420

Summary: [null][correlation] Wrong "potential null pointer access" with boolean
Product: [Eclipse Project] JDT Reporter: Björn Schönrock <private1>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P3 CC: stephan.herrmann
Version: 4.7.3   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:

Description Björn Schönrock CLA 2018-08-30 09:36:45 EDT
I have the following code:


final boolean announce = ...;
final String announcement = announce ? ... : null;

if (announce) {
  announcement.doStuff(); // "Potential null pointer access: The variable announcement may be null at this location"
}


I don't think I need to explain anything here.
Comment 1 Stephan Herrmann CLA 2018-08-30 10:21:40 EDT
(In reply to Björn Schönrock from comment #0)
> I don't think I need to explain anything here.

Please find my explanation in the other bug :)

*** This bug has been marked as a duplicate of bug 538421 ***