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

Bug 366661

Summary: Potential null pointer access: Initialize in while and break out
Product: [Eclipse Project] JDT Reporter: Nathan Reynolds <numeralnathan>
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: a.t.hofkamp, amj87.iitr, remy.suen, stephan.herrmann
Version: 3.8   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description Nathan Reynolds CLA 2011-12-13 23:44:40 EST
Build Identifier: 20110916-0149

The following gives a "potential null pointer access" warning.  There are no paths out of the while loop where value can be null.  This example is a very simplified version of the actual code that produced the problem.

      Object value;
      
      value = null;
      
      while (true)
      {
         value = new Object();
         
         if (value.hashCode() == 0)
            break;
      }
      
      value.toString();  // Warning here


Reproducible: Always

Steps to Reproduce:
1.  Paste the code in the details into a Java editor
2.  Compile
3.  See the problem/warning show up
Comment 1 Eclipse Genie CLA 2019-11-04 07:01:29 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.