fix constructor arguments for extended inner classes

master
Alexandru-Constantin Bledea 9 years ago
parent 93a39b7b50
commit 0e514a6253
  1. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java
  2. 3
      test/org/jetbrains/java/decompiler/SingleClassesTest.java
  3. BIN
      testData/classes/pkg/TestExtendingSubclass$Subclass1.class
  4. BIN
      testData/classes/pkg/TestExtendingSubclass$Subclass2.class
  5. BIN
      testData/classes/pkg/TestExtendingSubclass.class
  6. 35
      testData/results/TestExtendingSubclass.dec
  7. 18
      testData/src/pkg/TestExtendingSubclass.java

@ -334,7 +334,7 @@ public class InvocationExprent extends Exprent {
boolean firstParameter = true; boolean firstParameter = true;
int start = isEnum ? 2 : 0; int start = isEnum ? 2 : 0;
for (int i = start; i < lstParameters.size(); i++) { for (int i = start; i < lstParameters.size(); i++) {
if (sigFields == null) { if (sigFields == null || null == sigFields.get(i)) {
if (!firstParameter) { if (!firstParameter) {
buf.append(", "); buf.append(", ");
} }

@ -84,6 +84,7 @@ public class SingleClassesTest {
@Test public void testMethodReferenceLetterClass() { doTest("pkg/TestMethodReferenceLetterClass"); } @Test public void testMethodReferenceLetterClass() { doTest("pkg/TestMethodReferenceLetterClass"); }
@Test public void testMemberAnnotations() { doTest("pkg/TestMemberAnnotations"); } @Test public void testMemberAnnotations() { doTest("pkg/TestMemberAnnotations"); }
@Test public void testStaticNameClash() { doTest("pkg/TestStaticNameClash"); } @Test public void testStaticNameClash() { doTest("pkg/TestStaticNameClash"); }
@Test public void testExtendingSubclass() { doTest("pkg/TestExtendingSubclass"); }
protected void doTest(String testFile, String... companionFiles) { protected void doTest(String testFile, String... companionFiles) {
ConsoleDecompiler decompiler = fixture.getDecompiler(); ConsoleDecompiler decompiler = fixture.getDecompiler();
@ -130,4 +131,4 @@ public class SingleClassesTest {
return files; return files;
} }
} }

@ -0,0 +1,35 @@
package pkg;
public class TestExtendingSubclass {
class Subclass2 extends TestExtendingSubclass.Subclass1 {
Subclass2(String name) {
super(name);// 14
}// 15
}
class Subclass1 {
Subclass1(String name) {
}// 9
}
}
class 'pkg/TestExtendingSubclass$Subclass2' {
method '<init> (Lpkg/TestExtendingSubclass;Ljava/lang/String;)V' {
8 5
b 6
}
}
class 'pkg/TestExtendingSubclass$Subclass1' {
method '<init> (Lpkg/TestExtendingSubclass;Ljava/lang/String;)V' {
9 11
}
}
Lines mapping:
9 <-> 12
14 <-> 6
15 <-> 7
Not mapped:
8
13

@ -0,0 +1,18 @@
package pkg;
import java.math.BigDecimal;
public class TestExtendingSubclass {
class Subclass1 {
Subclass1(String name) {
}
}
class Subclass2 extends Subclass1 {
Subclass2(String name) {
super(name);
}
}
}
Loading…
Cancel
Save