fixed static interface methods
This commit is contained in:
@@ -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 ");
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
BIN
testData/classes/pkg/TestInterfaceMethods.class
Normal file
BIN
testData/classes/pkg/TestInterfaceMethods.class
Normal file
Binary file not shown.
23
testData/results/TestInterfaceMethods.dec
Normal file
23
testData/results/TestInterfaceMethods.dec
Normal 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
|
||||
6
testData/src/pkg/TestInterfaceMethods.java
Normal file
6
testData/src/pkg/TestInterfaceMethods.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package pkg;
|
||||
|
||||
public interface TestInterfaceMethods {
|
||||
static void staticMethod() {}
|
||||
default void defaultMethod() {}
|
||||
}
|
||||
Reference in New Issue
Block a user