Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366661 - Potential null pointer access: Initialize in while and break out
Summary: Potential null pointer access: Initialize in while and break out
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.8   Edit
Hardware: PC Windows 7
: P3 minor with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-13 23:44 EST by Nathan Reynolds CLA
Modified: 2019-11-04 07:01 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.