fixed static interface methods

This commit is contained in:
Egor.Ushakov
2017-04-26 20:14:23 +03:00
parent 6a7763922b
commit 478e6896e9
5 changed files with 31 additions and 1 deletions

View File

@@ -624,7 +624,7 @@ public class ClassWriter {
appendModifiers(buffer, flags, METHOD_ALLOWED, isInterface, METHOD_EXCLUDED); appendModifiers(buffer, flags, METHOD_ALLOWED, isInterface, METHOD_EXCLUDED);
if (isInterface && mt.containsCode()) { if (isInterface && !mt.hasModifier(CodeConstants.ACC_STATIC) && mt.containsCode()) {
// 'default' modifier (Java 8) // 'default' modifier (Java 8)
buffer.append("default "); buffer.append("default ");
} }

View File

@@ -111,6 +111,7 @@ public class SingleClassesTest {
//@Test public void TestSwitchOnStrings() { doTest("pkg/TestSwitchOnStrings");} //@Test public void TestSwitchOnStrings() { doTest("pkg/TestSwitchOnStrings");}
@Test public void testVarArgCalls() { doTest("pkg/TestVarArgCalls"); } @Test public void testVarArgCalls() { doTest("pkg/TestVarArgCalls"); }
@Test public void testLambdaParams() { doTest("pkg/TestLambdaParams"); } @Test public void testLambdaParams() { doTest("pkg/TestLambdaParams"); }
@Test public void testInterfaceMethods() { doTest("pkg/TestInterfaceMethods"); }
private void doTest(String testFile, String... companionFiles) { private void doTest(String testFile, String... companionFiles) {
ConsoleDecompiler decompiler = fixture.getDecompiler(); ConsoleDecompiler decompiler = fixture.getDecompiler();

Binary file not shown.

View File

@@ -0,0 +1,23 @@
package pkg;
public interface TestInterfaceMethods {
static void staticMethod() {
}// 4
default void defaultMethod() {
}// 5
}
class 'pkg/TestInterfaceMethods' {
method 'staticMethod ()V' {
0 4
}
method 'defaultMethod ()V' {
0 7
}
}
Lines mapping:
4 <-> 5
5 <-> 8

View File

@@ -0,0 +1,6 @@
package pkg;
public interface TestInterfaceMethods {
static void staticMethod() {}
default void defaultMethod() {}
}