distinguish static and default methods in cls interfaces (IDEA-140371)

This commit is contained in:
Anna Kozlova
2015-05-17 13:33:35 +02:00
parent fac26d1c7e
commit e9cfd2dd0c
3 changed files with 24 additions and 1 deletions
@@ -256,7 +256,7 @@ public class StubBuildingVisitor<T> extends ClassVisitor {
if ((access & Opcodes.ACC_ABSTRACT) != 0) {
flags |= ModifierFlags.ABSTRACT_MASK;
}
else if (isInterface) {
else if (isInterface && (access & Opcodes.ACC_STATIC) == 0) {
flags |= ModifierFlags.DEFENDER_MASK;
}
if ((access & Opcodes.ACC_STRICT) != 0) {
@@ -0,0 +1,16 @@
// IntelliJ API Decompiler stub source generated from a class file
// Implementation of methods is not available
package java.util.function;
@java.lang.FunctionalInterface
public interface Function <T, R> {
R apply(T t);
default <V> java.util.function.Function<V,R> compose(java.util.function.Function<? super V,? extends T> function) { /* compiled code */ }
default <V> java.util.function.Function<T,V> andThen(java.util.function.Function<? super R,? extends V> function) { /* compiled code */ }
static <T> java.util.function.Function<T,T> identity() { /* compiled code */ }
}
@@ -82,6 +82,13 @@ public class ClsMirrorBuildingTest extends LightIdeaTestCase {
doTest(clsPath, txtPath);
}
public void testStaticMethodInInterface() {
String testDir = JavaTestUtil.getJavaTestDataPath();
String clsPath = testDir + "/../../mockJDK-1.8/jre/lib/rt.jar!/java/util/function/Function.class";
String txtPath = testDir + "/psi/cls/mirror/Function.txt";
doTest(clsPath, txtPath);
}
public void testStrayInnersFiltering() throws IOException {
String path = JavaTestUtil.getJavaTestDataPath() + "/../../mockJDK-1.8/jre/lib/rt.jar!/java/lang/Class.class";
VirtualFile file = StandardFileSystems.jar().findFileByPath(path);