Community
Participate
Working Groups
The compiler should show a warning on switch(s). -------------------------------------------------------------- void foo() { String s = null; switch (s) { // should be a warning here case "abcd": System.out.println("abcd"); break; case "xyz": System.out.println("xyz"); break; default: System.out.println("oops"); break; } } --------------------------------------------------------------
This is the only case in which strings can cause an NPE. So needs to be included in null analysis.
Created attachment 197414 [details] proposed fix v1.0 + regression tests
Released in BETA_JAVA7 branch.
Verified using "Eclipse Java Development Tools Patch for Java 7 Support (BETA) 1.0.0.v20110623-0900 org.eclipse.jdt.patch.feature.group Eclipse.org"