Weird false-positive of javac data flow analysis
问题 I have code of the following form: class Test { private final A t; public Test() { for ( ... : ... ) { final A u = null; } t = new A(); } private class A {} } Compiler says: variable t might already have been assigned Interestingly, if I perform any of the following changes to the loop it works out! Change the loop's content to A u = null Remove the loop (but keep final A u = null; ) Replace the foreach-style loop with a classic counting loop What is going on here? Note: I could not get the