Lines 1032-1038
Link Here
|
1032 |
""); |
1032 |
""); |
1033 |
} |
1033 |
} |
1034 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162918 |
1034 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162918 |
1035 |
public void _test034() { |
1035 |
public void test034() { |
1036 |
this.runNegativeTest( |
1036 |
this.runNegativeTest( |
1037 |
new String[] { |
1037 |
new String[] { |
1038 |
"X.java", |
1038 |
"X.java", |
Lines 1045-1054
Link Here
|
1045 |
" System.out.println(i); // should complain: i not initialized\n" + |
1045 |
" System.out.println(i); // should complain: i not initialized\n" + |
1046 |
" }\n" + |
1046 |
" }\n" + |
1047 |
" }\n" + |
1047 |
" }\n" + |
1048 |
"}", |
1048 |
"}" |
1049 |
}, |
1049 |
}, |
1050 |
"----------\n" + |
1050 |
"----------\n" + |
1051 |
"2 ERRORS" + |
1051 |
"1. ERROR in X.java (at line 6)\n" + |
|
|
1052 |
" case i: // should complain: i not initialized\n" + |
1053 |
" ^\n" + |
1054 |
"The local variable i may not have been initialized\n" + |
1055 |
"----------\n" + |
1056 |
"2. ERROR in X.java (at line 7)\n" + |
1057 |
" System.out.println(i); // should complain: i not initialized\n" + |
1058 |
" ^\n" + |
1059 |
"The local variable i may not have been initialized\n" + |
1052 |
"----------\n"); |
1060 |
"----------\n"); |
1053 |
} |
1061 |
} |
1054 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162918 |
1062 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162918 |
Lines 1076-1105
Link Here
|
1076 |
"----------\n"); |
1084 |
"----------\n"); |
1077 |
} |
1085 |
} |
1078 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162918 |
1086 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162918 |
1079 |
// variant |
1087 |
// variant - not a flow analysis issue per se, contrast with 34 and 35 above |
1080 |
public void _test036() { |
1088 |
public void test036() { |
1081 |
this.runNegativeTest( |
1089 |
String src = |
1082 |
new String[] { |
1090 |
"public class X {\n" + |
1083 |
"X.java", |
1091 |
" void foo3() {\n" + |
1084 |
"public class X {\n" + |
1092 |
" switch (1) {\n" + |
1085 |
" void foo3() {\n" + |
1093 |
" case 0:\n" + |
1086 |
" switch (1) {\n" + |
1094 |
" class Local {\n" + |
1087 |
" case 0:\n" + |
1095 |
" }\n" + |
1088 |
" class Local {\n" + |
1096 |
" ;\n" + |
1089 |
" }\n" + |
1097 |
" case 1:\n" + |
1090 |
" ;\n" + |
1098 |
" new Local();\n" + // complain for compliance >= 1.4 |
1091 |
" case 1:\n" + |
1099 |
" }\n" + |
1092 |
" new Local(); // should complain: Local undefined\n" + |
1100 |
" }\n" + |
1093 |
" }\n" + |
1101 |
"}"; |
1094 |
" }\n" + |
1102 |
if (complianceLevel.compareTo(COMPLIANCE_1_3) <= 0) { |
1095 |
"}", |
1103 |
this.runConformTest( |
1096 |
}, |
1104 |
new String[] { |
1097 |
"----------\n" + |
1105 |
"X.java", |
1098 |
"1. ERROR in X.java (at line 9)\n" + |
1106 |
src |
1099 |
" new Local(); // should complain: Local undefined\n" + |
1107 |
}, |
1100 |
" ^^^^^\n" + |
1108 |
"" |
1101 |
"Local cannot be resolved to a type\n" + |
1109 |
); |
1102 |
"----------\n"); |
1110 |
} else { |
|
|
1111 |
this.runNegativeTest( |
1112 |
new String[] { |
1113 |
"X.java", |
1114 |
src |
1115 |
}, |
1116 |
"----------\n" + |
1117 |
"1. ERROR in X.java (at line 9)\n" + |
1118 |
" new Local();\n" + |
1119 |
" ^^^^^\n" + |
1120 |
"Local cannot be resolved to a type\n" + |
1121 |
"----------\n"); |
1122 |
} |
1103 |
} |
1123 |
} |
1104 |
public static Class testClass() { |
1124 |
public static Class testClass() { |
1105 |
return FlowAnalysisTest.class; |
1125 |
return FlowAnalysisTest.class; |