### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java,v retrieving revision 1.58 diff -u -r1.58 UnconditionalFlowInfo.java --- compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java 26 Sep 2006 12:04:03 -0000 1.58 +++ compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java 10 Nov 2006 15:10:28 -0000 @@ -696,10 +696,6 @@ if ((this.tagBits & UNREACHABLE) != 0) { return true; } - // final constants are inlined, and thus considered as always initialized - if (local.constant() != Constant.NotAConstant) { - return true; - } return isDefinitelyAssigned(local.id + this.maxFieldCount); } #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java,v retrieving revision 1.16 diff -u -r1.16 FlowAnalysisTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java 9 Nov 2006 11:07:10 -0000 1.16 +++ src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java 10 Nov 2006 15:10:30 -0000 @@ -1032,7 +1032,7 @@ ""); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=162918 -public void _test034() { +public void test034() { this.runNegativeTest( new String[] { "X.java", @@ -1045,10 +1045,18 @@ " System.out.println(i); // should complain: i not initialized\n" + " }\n" + " }\n" + - "}", + "}" }, "----------\n" + - "2 ERRORS" + + "1. ERROR in X.java (at line 6)\n" + + " case i: // should complain: i not initialized\n" + + " ^\n" + + "The local variable i may not have been initialized\n" + + "----------\n" + + "2. ERROR in X.java (at line 7)\n" + + " System.out.println(i); // should complain: i not initialized\n" + + " ^\n" + + "The local variable i may not have been initialized\n" + "----------\n"); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=162918 @@ -1076,30 +1084,42 @@ "----------\n"); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=162918 -// variant -public void _test036() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo3() {\n" + - " switch (1) {\n" + - " case 0:\n" + - " class Local {\n" + - " }\n" + - " ;\n" + - " case 1:\n" + - " new Local(); // should complain: Local undefined\n" + - " }\n" + - " }\n" + - "}", - }, - "----------\n" + - "1. ERROR in X.java (at line 9)\n" + - " new Local(); // should complain: Local undefined\n" + - " ^^^^^\n" + - "Local cannot be resolved to a type\n" + - "----------\n"); +// variant - not a flow analysis issue per se, contrast with 34 and 35 above +public void test036() { + String src = + "public class X {\n" + + " void foo3() {\n" + + " switch (1) {\n" + + " case 0:\n" + + " class Local {\n" + + " }\n" + + " ;\n" + + " case 1:\n" + + " new Local();\n" + // complain for compliance >= 1.4 + " }\n" + + " }\n" + + "}"; + if (complianceLevel.compareTo(COMPLIANCE_1_3) <= 0) { + this.runConformTest( + new String[] { + "X.java", + src + }, + "" + ); + } else { + this.runNegativeTest( + new String[] { + "X.java", + src + }, + "----------\n" + + "1. ERROR in X.java (at line 9)\n" + + " new Local();\n" + + " ^^^^^\n" + + "Local cannot be resolved to a type\n" + + "----------\n"); + } } public static Class testClass() { return FlowAnalysisTest.class;