Lines 233-239
Link Here
|
233 |
assertTrue(false); |
233 |
assertTrue(false); |
234 |
} |
234 |
} |
235 |
} |
235 |
} |
|
|
236 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=180471 - variation |
237 |
public void test005() { |
238 |
this.runConformTest( |
239 |
new String[] { |
240 |
"X.java", |
241 |
"public class X {\n" + |
242 |
" public static void main(String[] args) {\n" + |
243 |
" int mode = 1;\n" + |
244 |
" loop: for (;;) {\n" + |
245 |
" switch (mode) {\n" + |
246 |
" case 2 :\n" + |
247 |
" return;\n" + |
248 |
" case 1:\n" + |
249 |
" mode = 2;\n" + |
250 |
" continue loop;\n" + |
251 |
" }\n" + |
252 |
" }\n" + |
253 |
" }\n" + |
254 |
"}", |
255 |
}, |
256 |
""); |
236 |
|
257 |
|
|
|
258 |
String expectedOutput = |
259 |
" // Method descriptor #15 ([Ljava/lang/String;)V\n" + |
260 |
" // Stack: 1, Locals: 2\n" + |
261 |
" public static void main(java.lang.String[] args);\n" + |
262 |
" 0 iconst_1\n" + |
263 |
" 1 istore_1 [mode]\n" + |
264 |
" 2 iload_1 [mode]\n" + |
265 |
" 3 tableswitch default: 27\n" + |
266 |
" case 1: 25\n" + |
267 |
" case 2: 24\n" + |
268 |
" 24 return\n" + |
269 |
" 25 iconst_2\n" + |
270 |
" 26 istore_1 [mode]\n" + |
271 |
" 27 goto 2\n" + |
272 |
" Line numbers:\n" + |
273 |
" [pc: 0, line: 3]\n" + |
274 |
" [pc: 2, line: 5]\n" + |
275 |
" [pc: 24, line: 7]\n" + |
276 |
" [pc: 25, line: 9]\n" + |
277 |
" [pc: 27, line: 4]\n" + |
278 |
" Local variable table:\n" + |
279 |
" [pc: 0, pc: 30] local: args index: 0 type: java.lang.String[]\n" + |
280 |
" [pc: 2, pc: 30] local: mode index: 1 type: int\n"; |
281 |
|
282 |
try { |
283 |
File f = new File(OUTPUT_DIR + File.separator + "X.class"); |
284 |
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f); |
285 |
ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler(); |
286 |
String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED); |
287 |
int index = result.indexOf(expectedOutput); |
288 |
if (index == -1 || expectedOutput.length() == 0) { |
289 |
System.out.println(Util.displayString(result, 3)); |
290 |
} |
291 |
if (index == -1) { |
292 |
assertEquals("Wrong contents", expectedOutput, result); |
293 |
} |
294 |
} catch (org.eclipse.jdt.core.util.ClassFormatException e) { |
295 |
assertTrue(false); |
296 |
} catch (IOException e) { |
297 |
assertTrue(false); |
298 |
} |
299 |
} |
237 |
public static Class testClass() { |
300 |
public static Class testClass() { |
238 |
return ForStatementTest.class; |
301 |
return ForStatementTest.class; |
239 |
} |
302 |
} |