fixed synthetic params

This commit is contained in:
Egor Ushakov
2018-01-11 11:23:40 +03:00
parent 6715ecf53d
commit 0bb1f6801c
9 changed files with 32 additions and 1 deletions

View File

@@ -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));

View File

@@ -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"); }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -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

View File

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

View File

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