diff --git a/src/org/jetbrains/java/decompiler/main/ClassWriter.java b/src/org/jetbrains/java/decompiler/main/ClassWriter.java index b7b8fb4..5646407 100644 --- a/src/org/jetbrains/java/decompiler/main/ClassWriter.java +++ b/src/org/jetbrains/java/decompiler/main/ClassWriter.java @@ -624,7 +624,7 @@ public class ClassWriter { 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) buffer.append("default "); } diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java index 8c770d5..fe54ecb 100644 --- a/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -111,6 +111,7 @@ public class SingleClassesTest { //@Test public void TestSwitchOnStrings() { doTest("pkg/TestSwitchOnStrings");} @Test public void testVarArgCalls() { doTest("pkg/TestVarArgCalls"); } @Test public void testLambdaParams() { doTest("pkg/TestLambdaParams"); } + @Test public void testInterfaceMethods() { doTest("pkg/TestInterfaceMethods"); } private void doTest(String testFile, String... companionFiles) { ConsoleDecompiler decompiler = fixture.getDecompiler(); diff --git a/testData/classes/pkg/TestInterfaceMethods.class b/testData/classes/pkg/TestInterfaceMethods.class new file mode 100644 index 0000000..1cc7d69 Binary files /dev/null and b/testData/classes/pkg/TestInterfaceMethods.class differ diff --git a/testData/results/TestInterfaceMethods.dec b/testData/results/TestInterfaceMethods.dec new file mode 100644 index 0000000..d27a839 --- /dev/null +++ b/testData/results/TestInterfaceMethods.dec @@ -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 diff --git a/testData/src/pkg/TestInterfaceMethods.java b/testData/src/pkg/TestInterfaceMethods.java new file mode 100644 index 0000000..26f7d76 --- /dev/null +++ b/testData/src/pkg/TestInterfaceMethods.java @@ -0,0 +1,6 @@ +package pkg; + +public interface TestInterfaceMethods { + static void staticMethod() {} + default void defaultMethod() {} +} \ No newline at end of file