Skip to content

Commit

Permalink
Revert commit 2bac9e4 as it has bade
Browse files Browse the repository at this point in the history
side effects and results in
#1063
  • Loading branch information
srikanth-sankaran authored and iloveeclipse committed May 16, 2023
1 parent f0fe507 commit 354897d
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,9 @@ Our initialization type state is the same as it was at the end of the just concl
elseLabel.place();
codeStream.load(this.primaryExceptionVariable);
codeStream.load(this.caughtThrowableVariable);
codeStream.if_acmpeq(postElseLabel);
codeStream.load(this.primaryExceptionVariable);
codeStream.load(this.caughtThrowableVariable);
codeStream.invokeThrowableAddSuppressed();
postElseLabel.place();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7828,10 +7828,10 @@ public void testBug380313b() throws Exception {
" 36 pop\n" +
" 37 return\n" +
" 38 aload 4 [fis]\n" +
" 40 ifnull 81\n" +
" 40 ifnull 86\n" +
" 43 aload 4 [fis]\n" +
" 45 invokevirtual java.io.FileInputStream.close() : void [25]\n" +
" 48 goto 81\n" +
" 48 goto 86\n" +
" 51 astore_2\n" +
" 52 aload 4 [fis]\n" +
" 54 ifnull 62\n" +
Expand All @@ -7844,47 +7844,49 @@ public void testBug380313b() throws Exception {
" 66 ifnonnull 74\n" +
" 69 aload_3\n" +
" 70 astore_2\n" +
" 71 goto 79\n" +

" 71 goto 84\n" +
" 74 aload_2\n" +
" 75 aload_3\n" +
" 76 invokevirtual java.lang.Throwable.addSuppressed(java.lang.Throwable) : void [32]\n" +
" 76 if_acmpeq 84\n" +
" 79 aload_2\n" +
" 80 athrow\n" +
" 81 iload_1 [i]\n" +
" 82 bipush 35\n" +
" 84 if_icmpne 117\n" +
" 87 aload_0 [this]\n" + // return 2
" 88 " + xBarCall +
" 91 pop\n" +
" 92 return\n" +
" 93 astore_2 [e]\n" +
" 94 aload_0 [this]\n" +
" 95 " + xBarCall +
" 98 pop\n" +
" 80 aload_3\n" +
" 81 invokevirtual java.lang.Throwable.addSuppressed(java.lang.Throwable) : void [32]\n" +
" 84 aload_2\n" +
" 85 athrow\n" +
" 86 iload_1 [i]\n" +
" 87 bipush 35\n" +
" 89 if_icmpne 122\n" +
" 92 aload_0 [this]\n" + // return 2
" 93 " + xBarCall +
" 96 pop\n" +
" 97 return\n" +
" 98 astore_2 [e]\n" +
" 99 aload_0 [this]\n" +
" 100 " + xBarCall +
" 103 pop\n" +
" 104 goto 122\n" +
" 107 astore 5\n" +
" 109 aload_0 [this]\n" +
" 110 " + xBarCall +
" 113 pop\n" +
" 114 aload 5\n" +
" 116 athrow\n" +
" 117 aload_0 [this]\n" +
" 118 " + xBarCall +
" 121 pop\n" +
" 122 return\n" +
" 104 aload_0 [this]\n" +
" 105 " + xBarCall +
" 108 pop\n" +
" 109 goto 127\n" +
" 112 astore 5\n" +
" 114 aload_0 [this]\n" +
" 115 " + xBarCall +
" 118 pop\n" +
" 119 aload 5\n" +
" 121 athrow\n" +
" 122 aload_0 [this]\n" +
" 123 " + xBarCall +
" 126 pop\n" +
" 127 return\n" +
" Exception Table:\n" +
" [pc: 17, pc: 22] -> 51 when : any\n" +
" [pc: 6, pc: 32] -> 64 when : any\n" +
" [pc: 38, pc: 64] -> 64 when : any\n" +
" [pc: 2, pc: 32] -> 93 when : java.io.IOException\n" +
" [pc: 38, pc: 87] -> 93 when : java.io.IOException\n" +
" [pc: 2, pc: 32] -> 107 when : any\n" +
" [pc: 38, pc: 87] -> 107 when : any\n" +
" [pc: 93, pc: 99] -> 107 when : any\n" +
" [pc: 2, pc: 32] -> 98 when : java.io.IOException\n" +
" [pc: 38, pc: 92] -> 98 when : java.io.IOException\n" +
" [pc: 2, pc: 32] -> 112 when : any\n" +
" [pc: 38, pc: 92] -> 112 when : any\n" +
" [pc: 98, pc: 104] -> 112 when : any\n" +
" Line numbers:\n" +
" [pc: 0, line: 5]\n" +
" [pc: 2, line: 7]\n" +
Expand All @@ -7893,35 +7895,35 @@ public void testBug380313b() throws Exception {
" [pc: 32, line: 15]\n" +
" [pc: 37, line: 8]\n" +
" [pc: 38, line: 9]\n" +
" [pc: 81, line: 10]\n" +
" [pc: 87, line: 15]\n" +
" [pc: 92, line: 11]\n" +
" [pc: 93, line: 12]\n" +
" [pc: 94, line: 13]\n" +
" [pc: 99, line: 15]\n" +
" [pc: 107, line: 14]\n" +
" [pc: 109, line: 15]\n" +
" [pc: 114, line: 16]\n" +
" [pc: 117, line: 15]\n" +
" [pc: 122, line: 17]\n" +
" [pc: 86, line: 10]\n" +
" [pc: 92, line: 15]\n" +
" [pc: 97, line: 11]\n" +
" [pc: 98, line: 12]\n" +
" [pc: 99, line: 13]\n" +
" [pc: 104, line: 15]\n" +
" [pc: 112, line: 14]\n" +
" [pc: 114, line: 15]\n" +
" [pc: 119, line: 16]\n" +
" [pc: 122, line: 15]\n" +
" [pc: 127, line: 17]\n" +
" Local variable table:\n" +
" [pc: 0, pc: 123] local: this index: 0 type: X\n" +
" [pc: 2, pc: 123] local: i index: 1 type: int\n" +
" [pc: 0, pc: 128] local: this index: 0 type: X\n" +
" [pc: 2, pc: 128] local: i index: 1 type: int\n" +
" [pc: 17, pc: 62] local: fis index: 4 type: java.io.FileInputStream\n" +
" [pc: 94, pc: 99] local: e index: 2 type: java.io.IOException\n" +
" [pc: 99, pc: 104] local: e index: 2 type: java.io.IOException\n" +
" Stack map table: number of frames 12\n" +
" [pc: 32, full, stack: {}, locals: {X, int, java.lang.Throwable, java.lang.Throwable, java.io.FileInputStream}]\n" +
" [pc: 38, same]\n" +
" [pc: 51, same_locals_1_stack_item, stack: {java.lang.Throwable}]\n" +
" [pc: 62, chop 1 local(s)]\n" +
" [pc: 64, same_locals_1_stack_item, stack: {java.lang.Throwable}]\n" +
" [pc: 74, same]\n" +
" [pc: 79, same]\n" +
" [pc: 81, chop 2 local(s)]\n" +
" [pc: 93, same_locals_1_stack_item, stack: {java.io.IOException}]\n" +
" [pc: 107, same_locals_1_stack_item, stack: {java.lang.Throwable}]\n" +
" [pc: 117, same]\n" +
" [pc: 122, same]\n";
" [pc: 84, same]\n" +
" [pc: 86, chop 2 local(s)]\n" +
" [pc: 98, same_locals_1_stack_item, stack: {java.io.IOException}]\n" +
" [pc: 112, same_locals_1_stack_item, stack: {java.lang.Throwable}]\n" +
" [pc: 122, same]\n" +
" [pc: 127, same]\n";
int index = actualOutput.indexOf(expectedOutput);
if (index == -1 || expectedOutput.length() == 0) {
System.out.println(Util.displayString(actualOutput, 2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4321,7 +4321,7 @@ public void testBug467230() {
null);
}
// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/934
public void testGHIssue934() {
public void _testGHIssue934() {
this.runConformTest(
true,
new String[] {
Expand Down Expand Up @@ -4360,6 +4360,42 @@ public void testGHIssue934() {
"",
null);
}

// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1063
// Regression in code generation for try with resources with the fix for Issue # 934
public void testGHIssue1063() {
this.runConformTest(
true,
new String[] {
"X.java",
"import java.io.Closeable;\n" +
"import java.io.IOException;\n" +
"\n" +
"public class X {\n" +
" public static void main(String[] args) throws IOException {\n" +
" try (DummyClosable closable = new DummyClosable()) {\n" +
" throw new IOException(\"OMG!!!\");\n" +
" } catch (IOException e) {\n" +
" throw e;\n" +
" }\n" +
" }\n" +
"\n" +
" static class DummyClosable implements Closeable {\n" +
" @Override\n" +
" public void close() throws IOException {\n" +
" System.out.println(\"Closed!\");\n" +
" }\n" +
" }\n" +
"}\n"
},
null,
null,
null,
"Closed!",
"java.io.IOException: OMG!!!\n" +
" at X.main(X.java:7)\n",
null);
}
public static Class testClass() {
return TryWithResourcesStatementTest.class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2238,7 +2238,7 @@ public void test051_codeblocks_resourceVariable() throws Exception {
" #85 @A(\n" +
" target type = 0x41 RESOURCE_VARIABLE\n" +
" local variable entries:\n" +
" [pc: 21, pc: 130] index: 3\n" +
" [pc: 21, pc: 135] index: 3\n" +
" )\n";
checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
}
Expand Down

0 comments on commit 354897d

Please sign in to comment.