Summary: | False positive "Potential null pointer access" warning after TestCase.fail | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Nick Radov <nradov> |
Component: | Core | Assignee: | Maxime Daniel <maxime_daniel> |
Status: | VERIFIED WONTFIX | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | david_audel, Olivier_Thomann |
Version: | 3.3.1 | ||
Target Milestone: | 3.4 M4 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Nick Radov
2007-11-16 13:58:25 EST
Thanks for your suggestion. I am afraid our current plans won't allow us to pursue it though. As you noticed, this is much like bug 132875 - a P5 as of today, and would call for an even more specific pattern, tied to JUnit, or for a cross methods analysis to discover that fail will throw an unchecked exception in all cases. Note that a few workarounds can help you get rid of the unwanted warning, such as: public void testNull() { final boolean[] array = getArray(); if (array == null) { fail("null"); return; } for (int i = 0; i < array.length; i++) { System.out.println(array[i]); } } which makes explicit to us that we exit from within the if block. Closing as WONTFIX. Verified for 3.4M4. |