Lines 233-236
Link Here
|
233 |
assertEquals("Wrong contents", expectedOutput, result); |
233 |
assertEquals("Wrong contents", expectedOutput, result); |
234 |
} |
234 |
} |
235 |
} |
235 |
} |
|
|
236 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=262717 |
237 |
public void test004() throws Exception { |
238 |
this.runConformTest( |
239 |
new String[] { |
240 |
"X.java", |
241 |
"public class X{\n" + |
242 |
" public class Inner {\n" + |
243 |
" public void foo() {\n" + |
244 |
" int i = 0;\n" + |
245 |
" final int NEW = 1;\n" + |
246 |
" if (i == NEW) {\n" + |
247 |
" System.out.println();\n" + |
248 |
" }\n" + |
249 |
" bar();\n" + |
250 |
" }\n" + |
251 |
" }\n" + |
252 |
" public void bar() {\n" + |
253 |
" System.out.println(\"SUCCESS\");\n" + |
254 |
" }\n" + |
255 |
" public static void main(String[] args) {\n" + |
256 |
" new X().new Inner().foo();\n" + |
257 |
" }\n" + |
258 |
"}", |
259 |
}, |
260 |
"SUCCESS"); |
261 |
|
262 |
String expectedOutput = |
263 |
" 22 return\n" + |
264 |
" Line numbers:\n" + |
265 |
" [pc: 0, line: 4]\n" + |
266 |
" [pc: 2, line: 5]\n" + |
267 |
" [pc: 4, line: 6]\n" + |
268 |
" [pc: 9, line: 7]\n" + |
269 |
" [pc: 15, line: 9]\n" + |
270 |
" [pc: 22, line: 10]\n" + |
271 |
" Local variable table:\n" + |
272 |
" [pc: 0, pc: 23] local: this index: 0 type: X.Inner\n" + |
273 |
" [pc: 2, pc: 23] local: i index: 1 type: int\n" + |
274 |
" [pc: 4, pc: 23] local: NEW index: 2 type: int\n"; |
275 |
|
276 |
File f = new File(OUTPUT_DIR + File.separator + "X$Inner.class"); |
277 |
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f); |
278 |
ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler(); |
279 |
String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED); |
280 |
int index = result.indexOf(expectedOutput); |
281 |
if (index == -1 || expectedOutput.length() == 0) { |
282 |
System.out.println(Util.displayString(result, 3)); |
283 |
} |
284 |
if (index == -1) { |
285 |
assertEquals("Wrong contents", expectedOutput, result); |
286 |
} |
287 |
} |
236 |
} |
288 |
} |