Lines 6132-6136
Link Here
|
6132 |
"Cannot reference a field before it is defined\n" + |
6132 |
"Cannot reference a field before it is defined\n" + |
6133 |
"----------\n"); |
6133 |
"----------\n"); |
6134 |
} |
6134 |
} |
|
|
6135 |
|
6136 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=267670. Make sure we don't emit any unused |
6137 |
// warnings about enumerators. Since these could be used in indirect ways not obvious. |
6138 |
public void test171() { |
6139 |
Map customOptions = getCompilerOptions(); |
6140 |
customOptions.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.WARNING); |
6141 |
this.runConformTest( |
6142 |
true, |
6143 |
new String[] { |
6144 |
"X.java", |
6145 |
"public class X { \n" + |
6146 |
" private enum Colors {\n" + |
6147 |
" BLEU,\n" + |
6148 |
" BLANC,\n" + |
6149 |
" ROUGE\n" + |
6150 |
" }\n" + |
6151 |
" public static void main(String[] args) {\n" + |
6152 |
" for (Colors c: Colors.values()) {\n" + |
6153 |
" System.out.print(c);\n" + |
6154 |
" }\n" + |
6155 |
" }\n" + |
6156 |
"}\n" |
6157 |
}, |
6158 |
null, customOptions, |
6159 |
"", |
6160 |
"BLEUBLANCROUGE", null, |
6161 |
JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); |
6162 |
} |
6163 |
|
6164 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=267670. Make sure we don't emit any unused |
6165 |
// warnings about enumerators. Since these could be used in indirect ways not obvious. This |
6166 |
// test also verifies that while we don't complain about individual enumerators not being used |
6167 |
// we DO complain if the enumeration type itself is not used. |
6168 |
public void test172() { |
6169 |
Map customOptions = getCompilerOptions(); |
6170 |
customOptions.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.WARNING); |
6171 |
this.runConformTest( |
6172 |
true, |
6173 |
new String[] { |
6174 |
"X.java", |
6175 |
"public class X { \n" + |
6176 |
" private enum Greet {\n" + |
6177 |
" HELLO, HOWDY, BONJOUR; \n" + |
6178 |
" }\n" + |
6179 |
" private enum Colors {\n" + |
6180 |
" RED, BLACK, BLUE;\n"+ |
6181 |
" }\n" + |
6182 |
" private enum Complaint {" + |
6183 |
" WARNING, ERROR, FATAL_ERROR, PANIC;\n" + |
6184 |
" }\n" + |
6185 |
" public static void main(String[] args) {\n" + |
6186 |
" Greet g = Greet.valueOf(\"HELLO\");\n" + |
6187 |
" System.out.print(g);\n" + |
6188 |
" Colors c = Greet.valueOf(Colors.class, \"RED\");\n" + |
6189 |
" System.out.print(c);\n" + |
6190 |
" }\n" + |
6191 |
"}\n" |
6192 |
}, |
6193 |
null, customOptions, |
6194 |
"----------\n" + |
6195 |
"1. WARNING in X.java (at line 8)\n" + |
6196 |
" private enum Complaint { WARNING, ERROR, FATAL_ERROR, PANIC;\n" + |
6197 |
" ^^^^^^^^^\n" + |
6198 |
"The type X.Complaint is never used locally\n" + |
6199 |
"----------\n", |
6200 |
"HELLORED", null, |
6201 |
JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings); |
6202 |
} |
6203 |
|
6135 |
} |
6204 |
} |
6136 |
|
6205 |
|