Fix super qualifier for default interfaces #855

master
JDLogic 6 years ago committed by Egor Ushakov
parent 21a80957bb
commit b53c895399
  1. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java
  2. 3
      test/org/jetbrains/java/decompiler/SingleClassesTest.java

@ -247,7 +247,9 @@ public class InvocationExprent extends Exprent {
if (invocationTyp == INVOKE_SPECIAL) { if (invocationTyp == INVOKE_SPECIAL) {
if (!classname.equals(this_classname)) { // TODO: direct comparison to the super class? if (!classname.equals(this_classname)) { // TODO: direct comparison to the super class?
super_qualifier = this_classname; StructClass cl = DecompilerContext.getStructContext().getClass(classname);
boolean isInterface = cl != null && (cl.getAccessFlags() & CodeConstants.ACC_INTERFACE) != 0;
super_qualifier = !isInterface ? this_classname : classname;
} }
} }
} }

@ -110,7 +110,7 @@ public class SingleClassesTest {
@Test public void testEmptyBlocks() { doTest("pkg/TestEmptyBlocks"); } @Test public void testEmptyBlocks() { doTest("pkg/TestEmptyBlocks"); }
@Test public void testPrivateEmptyConstructor() { doTest("pkg/TestPrivateEmptyConstructor"); } @Test public void testPrivateEmptyConstructor() { doTest("pkg/TestPrivateEmptyConstructor"); }
@Test public void testSynchronizedUnprotected() { doTest("pkg/TestSynchronizedUnprotected"); } @Test public void testSynchronizedUnprotected() { doTest("pkg/TestSynchronizedUnprotected"); }
@Test public void testInterfaceSuper() { doTest("pkg/TestInterfaceSuper"); }
// TODO: fix all below // TODO: fix all below
//@Test public void testPackageInfo() { doTest("pkg/package-info"); } //@Test public void testPackageInfo() { doTest("pkg/package-info"); }
@ -118,7 +118,6 @@ public class SingleClassesTest {
//@Test public void testUnionType() { doTest("pkg/TestUnionType"); } //@Test public void testUnionType() { doTest("pkg/TestUnionType"); }
//@Test public void testInnerClassConstructor2() { doTest("pkg/TestInner2"); } //@Test public void testInnerClassConstructor2() { doTest("pkg/TestInner2"); }
//@Test public void testInUse() { doTest("pkg/TestInUse"); } //@Test public void testInUse() { doTest("pkg/TestInUse"); }
//@Test public void testInterfaceSuper() { doTest("pkg/TestInterfaceSuper"); }
@Test public void testGroovyClass() { doTest("pkg/TestGroovyClass"); } @Test public void testGroovyClass() { doTest("pkg/TestGroovyClass"); }
@Test public void testGroovyTrait() { doTest("pkg/TestGroovyTrait"); } @Test public void testGroovyTrait() { doTest("pkg/TestGroovyTrait"); }

Loading…
Cancel
Save