Community
Participate
Working Groups
Created attachment 278398 [details] Screenshot-of-example I found the following issue, that a possible NPE is not reported when the code is in a finally statement and a loop is involved. How to reproduce: - Create a new project - enable annotation based NPE (http://help.eclipse.org/oxygen/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-using_null_annotations.htm) - take this example code ----------------- import java.util.Arrays; import java.util.List; import org.eclipse.jdt.annotation.Nullable; public class NullDemo { @Nullable private String getNull() { return null; } public void testInLoop() { List<Integer> arr = Arrays.asList(1, 2, 3); for (Integer elem : arr) { try { System.out.println(elem); String s1 = getNull(); s1.toString(); // marked as potential NPE } finally { String s2 = getNull(); s2.toString(); // NOT marked as potential NPE } String s3 = getNull(); s3.toString(); // marked as potential NPE } } public void testWithoutLoop() { while (true) { try { } catch (Exception e) { String s1 = getNull(); s1.toString(); // marked as potential NPE } finally { String s2 = getNull(); s2.toString(); // marked as potential NPE } String s3 = getNull(); s3.toString(); // marked as potential NPE } } } ----------------- See the screenshot. The blue bordered line should be marked as possible NPE, too. cheers Roland
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.