(JDK 1.6.0_23, Eclipse 3.7.0 with "Potential null pointer access" warning level at "Warning") Consider the following example code:
Object obj = null;
for (;;) {
obj = getObject();
if (obj != null) break;
Thread.sleep(25);
}
obj.toString();
I'm getting the following warning on the last line: Potential null pointer access: The variable obj may be null at this location. Is there any real way for obj to actually be null or why the compiler thinks so?
.toString()?javacI guess.) What compiler switches?