fixed synthetic params

master
Egor Ushakov 7 years ago
parent 6715ecf53d
commit 0bb1f6801c
  1. 5
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/ExprUtil.java
  2. 1
      test/org/jetbrains/java/decompiler/SingleClassesTest.java
  3. BIN
      testData/classes/pkg/TestSuperInner$Inner.class
  4. BIN
      testData/classes/pkg/TestSuperInner.class
  5. BIN
      testData/classes/pkg/TestSuperInner2$Inner2.class
  6. BIN
      testData/classes/pkg/TestSuperInner2.class
  7. 17
      testData/results/TestSuperInner2.dec
  8. 6
      testData/src/pkg/TestSuperInner.java
  9. 4
      testData/src/pkg/TestSuperInner2.java

@ -1,3 +1,6 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package org.jetbrains.java.decompiler.modules.decompiler.exps;
import org.jetbrains.java.decompiler.code.CodeConstants;
@ -24,7 +27,7 @@ public class ExprUtil {
// own class
mask = wrapper.getMethodWrapper(CodeConstants.INIT_NAME, descriptor).synthParameters;
}
else if (parameters > 0 && node.type == ClassNode.CLASS_MEMBER && node.classStruct.hasModifier(CodeConstants.ACC_STATIC)) {
else if (parameters > 0 && node.type == ClassNode.CLASS_MEMBER && (node.access & CodeConstants.ACC_STATIC) == 0) {
// non-static member class
mask = new ArrayList<>(Collections.nCopies(parameters, null));
mask.set(0, new VarVersionPair(-1, 0));

@ -105,6 +105,7 @@ public class SingleClassesTest {
@Test public void testPop2OneLongPop2() { doTest("pkg/TestPop2OneLongPop2"); }
@Test public void testPop2TwoIntPop2() { doTest("pkg/TestPop2TwoIntPop2"); }
@Test public void testPop2TwoIntTwoPop() { doTest("pkg/TestPop2TwoIntTwoPop"); }
@Test public void testSuperInner2() { doTest("pkg/TestSuperInner2", "pkg/TestSuperInner"); }
// TODO: fix all below
//@Test public void testPackageInfo() { doTest("pkg/package-info"); }

@ -0,0 +1,17 @@
class TestSuperInner2 extends TestSuperInner {
protected class Inner2 extends TestSuperInner.Inner {
protected Inner2() {
super();// 2
}
}
}
class 'TestSuperInner2$Inner2' {
method '<init> (LTestSuperInner2;)V' {
7 3
a 4
}
}
Lines mapping:
2 <-> 4

@ -0,0 +1,6 @@
public class TestSuperInner {
protected abstract class Inner {
protected Inner() {
}
}
}

@ -0,0 +1,4 @@
class TestSuperInner2 extends TestSuperInner {
protected class Inner2 extends Inner {
}
}
Loading…
Cancel
Save