Lines 46336-46342
Link Here
|
46336 |
"----------\n"); |
46336 |
"----------\n"); |
46337 |
} |
46337 |
} |
46338 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 |
46338 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 |
46339 |
public void _test1381() throws Exception { |
46339 |
public void test1381() throws Exception { |
46340 |
this.runConformTest( |
46340 |
this.runConformTest( |
46341 |
new String[] { |
46341 |
new String[] { |
46342 |
"X.java", |
46342 |
"X.java", |
Lines 46361-46390
Link Here
|
46361 |
"}\n", |
46361 |
"}\n", |
46362 |
"p/IB.java", // ===================== |
46362 |
"p/IB.java", // ===================== |
46363 |
"package p;\n" + |
46363 |
"package p;\n" + |
46364 |
"interface IA {\n" + |
46364 |
"interface IA {\n" + // non visible |
46365 |
" void baz();\n" + |
46365 |
" void baz();\n" + |
46366 |
"}\n" + |
46366 |
"}\n" + |
46367 |
"public interface IB extends IA {\n" + |
46367 |
"public interface IB extends IA {\n" + |
46368 |
"}\n", |
46368 |
"}\n", |
46369 |
}, |
46369 |
}, |
46370 |
"done"); |
46370 |
"done"); |
46371 |
// check #baz() invocation declaring class is IA |
46371 |
// check #baz() invocation declaring class is IB |
46372 |
String expectedOutput = |
46372 |
String expectedOutput = |
46373 |
" // Method descriptor #21 (LX;)V\n" + |
46373 |
" // Method descriptor #10 ()V\n" + |
46374 |
" // Signature: (LX<TT;>;)V\n" + |
46374 |
" // Stack: 1, Locals: 1\n" + |
46375 |
" // Stack: 1, Locals: 2\n" + |
46375 |
" void foo();\n" + |
46376 |
" void foo(X xt);\n" + |
46376 |
" 0 aload_0 [this]\n" + |
46377 |
" 0 aload_1 [xt]\n" + |
46377 |
" 1 getfield X.t : AA [21]\n" + |
46378 |
" 1 invokevirtual X.get() : AA [23]\n" + |
46378 |
" 4 checkcast p.IB [23]\n" + |
46379 |
" 4 checkcast p.IA [25]\n" + |
46379 |
" 7 invokeinterface p.IB.baz() : void [25] [nargs: 1]\n" + |
46380 |
" 7 invokeinterface p.IA.baz() : void [27] [nargs: 1]\n" + |
|
|
46381 |
" 12 return\n" + |
46380 |
" 12 return\n" + |
46382 |
" Line numbers:\n" + |
46381 |
" Line numbers:\n" + |
46383 |
" [pc: 0, line: 5]\n" + |
46382 |
" [pc: 0, line: 4]\n" + |
46384 |
" [pc: 12, line: 6]\n" + |
46383 |
" [pc: 12, line: 5]\n" + |
46385 |
" Local variable table:\n" + |
46384 |
" Local variable table:\n" + |
46386 |
" [pc: 0, pc: 13] local: this index: 0 type: X\n" + |
46385 |
" [pc: 0, pc: 13] local: this index: 0 type: X\n"; |
46387 |
" [pc: 0, pc: 13] local: xt index: 1 type: X\n"; |
|
|
46388 |
|
46386 |
|
46389 |
File f = new File(OUTPUT_DIR + File.separator + "X.class"); |
46387 |
File f = new File(OUTPUT_DIR + File.separator + "X.class"); |
46390 |
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f); |
46388 |
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f); |
Lines 46399-46405
Link Here
|
46399 |
} |
46397 |
} |
46400 |
} |
46398 |
} |
46401 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 - variation |
46399 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 - variation |
46402 |
public void _test1382() throws Exception { |
46400 |
public void test1382() throws Exception { |
46403 |
this.runConformTest( |
46401 |
this.runConformTest( |
46404 |
new String[] { |
46402 |
new String[] { |
46405 |
"X.java", |
46403 |
"X.java", |
Lines 46452-46458
Link Here
|
46452 |
} |
46450 |
} |
46453 |
} |
46451 |
} |
46454 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 - variation |
46452 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 - variation |
46455 |
public void _test1383() throws Exception { |
46453 |
public void test1383() throws Exception { |
46456 |
this.runConformTest( |
46454 |
this.runConformTest( |
46457 |
new String[] { |
46455 |
new String[] { |
46458 |
"X.java", |
46456 |
"X.java", |
Lines 46507-46513
Link Here
|
46507 |
} |
46505 |
} |
46508 |
} |
46506 |
} |
46509 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 - variation |
46507 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 - variation |
46510 |
public void _test1384() throws Exception { |
46508 |
public void test1384() throws Exception { |
46511 |
this.runConformTest( |
46509 |
this.runConformTest( |
46512 |
new String[] { |
46510 |
new String[] { |
46513 |
"X.java", |
46511 |
"X.java", |
Lines 46561-46567
Link Here
|
46561 |
} |
46559 |
} |
46562 |
} |
46560 |
} |
46563 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 - variation |
46561 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 - variation |
46564 |
public void _test1385() throws Exception { |
46562 |
public void test1385() throws Exception { |
46565 |
this.runConformTest( |
46563 |
this.runConformTest( |
46566 |
new String[] { |
46564 |
new String[] { |
46567 |
"X.java", |
46565 |
"X.java", |
Lines 46613-46619
Link Here
|
46613 |
} |
46611 |
} |
46614 |
} |
46612 |
} |
46615 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 - variation |
46613 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 - variation |
46616 |
public void _test1386() throws Exception { |
46614 |
public void test1386() throws Exception { |
46617 |
this.runConformTest( |
46615 |
this.runConformTest( |
46618 |
new String[] { |
46616 |
new String[] { |
46619 |
"X.java", |
46617 |
"X.java", |
Lines 46635-46641
Link Here
|
46635 |
"public interface IB extends IA {\n" + |
46633 |
"public interface IB extends IA {\n" + |
46636 |
"}\n", |
46634 |
"}\n", |
46637 |
}, |
46635 |
}, |
46638 |
"111"); |
46636 |
""); |
46639 |
// check #baz() invocation declaring class is not IA |
46637 |
// check #baz() invocation declaring class is not IA |
46640 |
String expectedOutput = |
46638 |
String expectedOutput = |
46641 |
" // Method descriptor #21 (LX;)V\n" + |
46639 |
" // Method descriptor #21 (LX;)V\n" + |
Lines 46667-46673
Link Here
|
46667 |
} |
46665 |
} |
46668 |
} |
46666 |
} |
46669 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 - variation |
46667 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 - variation |
46670 |
public void _test1387() throws Exception { |
46668 |
public void test1387() throws Exception { |
46671 |
this.runConformTest( |
46669 |
this.runConformTest( |
46672 |
new String[] { |
46670 |
new String[] { |
46673 |
"X.java", |
46671 |
"X.java", |
Lines 46698-46718
Link Here
|
46698 |
"done"); |
46696 |
"done"); |
46699 |
// check #baz declaring class is not IA |
46697 |
// check #baz declaring class is not IA |
46700 |
String expectedOutput = |
46698 |
String expectedOutput = |
46701 |
" // Method descriptor #21 (LX;)V\n" + |
46699 |
" // Method descriptor #10 ()V\n" + |
46702 |
" // Signature: (LX<TT;>;)V\n" + |
46700 |
" // Stack: 2, Locals: 1\n" + |
46703 |
" // Stack: 1, Locals: 2\n" + |
46701 |
" void foo();\n" + |
46704 |
" void foo(X xt);\n" + |
46702 |
" 0 getstatic java.lang.System.out : java.io.PrintStream [21]\n" + |
46705 |
" 0 aload_1 [xt]\n" + |
46703 |
" 3 aload_0 [this]\n" + |
46706 |
" 1 invokevirtual X.get() : AA [23]\n" + |
46704 |
" 4 getfield X.t : AA [27]\n" + |
46707 |
" 4 checkcast p.IB [25]\n" + |
46705 |
" 7 checkcast p.IB [29]\n" + |
46708 |
" 7 invokeinterface p.IB.baz() : void [27] [nargs: 1]\n" + |
46706 |
" 10 pop\n" + |
46709 |
" 12 return\n" + |
46707 |
" 11 getstatic p.IB.baz : java.lang.Object [31]\n" + |
|
|
46708 |
" 14 invokevirtual java.io.PrintStream.println(java.lang.Object) : void [35]\n" + |
46709 |
" 17 return\n" + |
46710 |
" Line numbers:\n" + |
46710 |
" Line numbers:\n" + |
46711 |
" [pc: 0, line: 5]\n" + |
46711 |
" [pc: 0, line: 4]\n" + |
46712 |
" [pc: 12, line: 6]\n" + |
46712 |
" [pc: 17, line: 5]\n" + |
46713 |
" Local variable table:\n" + |
46713 |
" Local variable table:\n" + |
46714 |
" [pc: 0, pc: 13] local: this index: 0 type: X\n" + |
46714 |
" [pc: 0, pc: 18] local: this index: 0 type: X\n"; |
46715 |
" [pc: 0, pc: 13] local: xt index: 1 type: X\n"; |
|
|
46716 |
|
46715 |
|
46717 |
File f = new File(OUTPUT_DIR + File.separator + "X.class"); |
46716 |
File f = new File(OUTPUT_DIR + File.separator + "X.class"); |
46718 |
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f); |
46717 |
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f); |
Lines 46727-46733
Link Here
|
46727 |
} |
46726 |
} |
46728 |
} |
46727 |
} |
46729 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 - variation |
46728 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 - variation |
46730 |
public void _test1388() throws Exception { |
46729 |
public void test1388() throws Exception { |
46731 |
this.runConformTest( |
46730 |
this.runConformTest( |
46732 |
new String[] { |
46731 |
new String[] { |
46733 |
"X.java", |
46732 |
"X.java", |
Lines 46758-46778
Link Here
|
46758 |
"done"); |
46757 |
"done"); |
46759 |
// check #baz declaring class is not IA |
46758 |
// check #baz declaring class is not IA |
46760 |
String expectedOutput = |
46759 |
String expectedOutput = |
46761 |
" // Method descriptor #21 (LX;)V\n" + |
46760 |
" // Method descriptor #10 ()V\n" + |
46762 |
" // Signature: (LX<TT;>;)V\n" + |
46761 |
" // Stack: 2, Locals: 1\n" + |
46763 |
" // Stack: 1, Locals: 2\n" + |
46762 |
" void foo();\n" + |
46764 |
" void foo(X xt);\n" + |
46763 |
" 0 getstatic java.lang.System.out : java.io.PrintStream [21]\n" + |
46765 |
" 0 aload_1 [xt]\n" + |
46764 |
" 3 aload_0 [this]\n" + |
46766 |
" 1 invokevirtual X.get() : AA [23]\n" + |
46765 |
" 4 getfield X.t : AA [27]\n" + |
46767 |
" 4 checkcast p.IB [25]\n" + |
46766 |
" 7 checkcast p.IB [29]\n" + |
46768 |
" 7 invokeinterface p.IB.baz() : void [27] [nargs: 1]\n" + |
46767 |
" 10 pop\n" + |
46769 |
" 12 return\n" + |
46768 |
" 11 getstatic p.IB.baz : java.lang.Object [31]\n" + |
|
|
46769 |
" 14 invokevirtual java.io.PrintStream.println(java.lang.Object) : void [35]\n" + |
46770 |
" 17 return\n" + |
46770 |
" Line numbers:\n" + |
46771 |
" Line numbers:\n" + |
46771 |
" [pc: 0, line: 5]\n" + |
46772 |
" [pc: 0, line: 4]\n" + |
46772 |
" [pc: 12, line: 6]\n" + |
46773 |
" [pc: 17, line: 5]\n" + |
46773 |
" Local variable table:\n" + |
46774 |
" Local variable table:\n" + |
46774 |
" [pc: 0, pc: 13] local: this index: 0 type: X\n" + |
46775 |
" [pc: 0, pc: 18] local: this index: 0 type: X\n"; |
46775 |
" [pc: 0, pc: 13] local: xt index: 1 type: X\n"; |
|
|
46776 |
|
46776 |
|
46777 |
File f = new File(OUTPUT_DIR + File.separator + "X.class"); |
46777 |
File f = new File(OUTPUT_DIR + File.separator + "X.class"); |
46778 |
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f); |
46778 |
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f); |
Lines 46787-46793
Link Here
|
46787 |
} |
46787 |
} |
46788 |
} |
46788 |
} |
46789 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 - variation |
46789 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=247953 - variation |
46790 |
public void _test1389() throws Exception { |
46790 |
public void test1389() throws Exception { |
46791 |
this.runConformTest( |
46791 |
this.runConformTest( |
46792 |
new String[] { |
46792 |
new String[] { |
46793 |
"X.java", |
46793 |
"X.java", |
Lines 47136-47139
Link Here
|
47136 |
assertEquals("Wrong contents", expectedOutput, result); |
47136 |
assertEquals("Wrong contents", expectedOutput, result); |
47137 |
} |
47137 |
} |
47138 |
} |
47138 |
} |
|
|
47139 |
public void test1396() throws Exception { |
47140 |
this.runConformTest( |
47141 |
new String[] { |
47142 |
"X.java", |
47143 |
"public class X<T extends SubX2<T>> {\n" + |
47144 |
" T sx1;\n" + |
47145 |
" void foo(T t) {\n" + |
47146 |
" t.sx2.t.getClass();\n" + |
47147 |
" }\n" + |
47148 |
"}\n" + |
47149 |
"interface X1<T extends X2<T>> {\n" + |
47150 |
"}\n" + |
47151 |
"abstract class SubX1<T extends X2<T>> implements X1<T> {\n" + |
47152 |
" T sx2;\n" + |
47153 |
"}\n" + |
47154 |
"interface X2<T extends X2<T>> extends X1<T>{\n" + |
47155 |
"}\n" + |
47156 |
"abstract class SubX2<T extends X2<T>> extends SubX1<T> implements X2<T> {\n" + |
47157 |
" T t;\n" + |
47158 |
"}\n", |
47159 |
}, |
47160 |
""); |
47161 |
String expectedOutput = |
47162 |
" // Method descriptor #21 (LSubX2;)V\n" + |
47163 |
" // Signature: (TT;)V\n" + |
47164 |
" // Stack: 1, Locals: 2\n" + |
47165 |
" void foo(SubX2 t);\n" + |
47166 |
" 0 aload_1 [t]\n" + |
47167 |
" 1 getfield SubX2.sx2 : X2 [23]\n" + |
47168 |
" 4 checkcast SubX2 [24]\n" + |
47169 |
" 7 getfield SubX2.t : X2 [29]\n" + |
47170 |
" 10 checkcast SubX2 [24]\n" + |
47171 |
" 13 invokevirtual java.lang.Object.getClass() : java.lang.Class [32]\n" + |
47172 |
" 16 pop\n" + |
47173 |
" 17 return\n" + |
47174 |
" Line numbers:\n" + |
47175 |
" [pc: 0, line: 4]\n" + |
47176 |
" [pc: 17, line: 5]\n" + |
47177 |
" Local variable table:\n" + |
47178 |
" [pc: 0, pc: 18] local: this index: 0 type: X\n" + |
47179 |
" [pc: 0, pc: 18] local: t index: 1 type: SubX2\n"; |
47180 |
|
47181 |
File f = new File(OUTPUT_DIR + File.separator + "X.class"); |
47182 |
byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f); |
47183 |
ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler(); |
47184 |
String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED); |
47185 |
int index = result.indexOf(expectedOutput); |
47186 |
if (index == -1 || expectedOutput.length() == 0) { |
47187 |
System.out.println(Util.displayString(result, 3)); |
47188 |
} |
47189 |
if (index == -1) { |
47190 |
assertEquals("Wrong contents", expectedOutput, result); |
47191 |
} |
47192 |
} |
47139 |
} |
47193 |
} |