Community
Participate
Working Groups
I20060918-0010 (But existed since 3.2 at least - detected in the code). Null related warnings on a given variable within a finally block may absorb null related warnings on a second variable within the same finally block. In the following cases, the second diagnostic is absorbed. Prepared test cases accordingly in NullReferenceTest. public class X { void foo(X x) { x = null; X y = null; try { } finally { if (x != null) { /* */ } // 1: complains as expected if (y != null) { /* */ } // 2: does not complain but it should } } } public class X { void foo(Object o) { o = null; Object o2 = null; try { /* */ } finally { o.toString(); // 1 o2.toString(); // 2 } } } public class X { void foo(X x) { x = null; X y = null; try { x = new X(); } finally { x.toString(); // 1 y.toString(); // 2 } } } public class X { void foo() { X x = new X(); X y = null; try { } finally { if (x != null) { // 1 x.toString(); } y.toString(); // 2 } } }
Will post patch once 3.3 M2 is declared (in order to avoid cumulative patch). Had to replace a return by a continue (or nothing at all) in selected places of FinallyFlowContext#complainOnDeferredChecks. Also removed some dead code in the same method (code probably died with proposed fix for bug 149665).
See patch of bug 150082. Released for 3.3M3.
Verified for 3.3 M3 using warm-up build I20061030-0800