Community
Participate
Working Groups
In the following code the "null reference analysis" produces a false positive: 1: Object element = null; 2: try { 3: element = foo(); 4: bar(element); 5: } catch (RuntimeException e) { 6: System.out.println(element.toString()); 7: } 8: private Object foo() { 9: return ""; 10: } 11: private void bar(Object element) { 12: throw new IllegalArgumentException(""); 13: } In line 6 "element" is considered as "can only be null" but should be "may be null". If you change line 11 to 11: private void bar(Object element) throws Exception { and line 5 to 5: } catch (Exception e) { you get the correct warning.
Reproduced with build I20060321-1210. Entered (skipped) test case NullReferenceTest #561.
Fixed and released in HEAD. The key for verification is to use an unchecked exception.
Verified for 3.2 M6 using warm-up build I20060327-0010.
Verified for 3.2M6. Mark as closed. Thanks