UnimplementedKotlinInterfaceMemberAnnotator: shouldn't report methods with @JvmStatic
#KT-27208 Fixed
This commit is contained in:
+3
-1
@@ -18,6 +18,7 @@ import com.intellij.psi.*
|
|||||||
import org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration
|
import org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration
|
||||||
import org.jetbrains.kotlin.asJava.elements.KtLightMethod
|
import org.jetbrains.kotlin.asJava.elements.KtLightMethod
|
||||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||||
|
import org.jetbrains.kotlin.resolve.annotations.JVM_STATIC_ANNOTATION_FQ_NAME
|
||||||
import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_DEFAULT_FQ_NAME
|
import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_DEFAULT_FQ_NAME
|
||||||
import org.jetbrains.kotlin.utils.ifEmpty
|
import org.jetbrains.kotlin.utils.ifEmpty
|
||||||
|
|
||||||
@@ -46,7 +47,8 @@ class UnimplementedKotlinInterfaceMemberAnnotator : Annotator {
|
|||||||
return signaturesFromKotlinInterfaces.firstOrNull {
|
return signaturesFromKotlinInterfaces.firstOrNull {
|
||||||
it !in signaturesVisibleThroughKotlinSuperClass &&
|
it !in signaturesVisibleThroughKotlinSuperClass &&
|
||||||
it.method.modifierList.annotations.none { annotation ->
|
it.method.modifierList.annotations.none { annotation ->
|
||||||
annotation.qualifiedName == JVM_DEFAULT_FQ_NAME.asString()
|
val qualifiedName = annotation.qualifiedName
|
||||||
|
qualifiedName == JVM_DEFAULT_FQ_NAME.asString() || qualifiedName == JVM_STATIC_ANNOTATION_FQ_NAME.asString()
|
||||||
}
|
}
|
||||||
}?.method as? KtLightMethod
|
}?.method as? KtLightMethod
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
class Test implements A { }
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface A {
|
||||||
|
companion object {
|
||||||
|
fun create() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
package test;
|
||||||
|
|
||||||
|
public class InterfaceWithJvmStatic implements A { }
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
interface A {
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
fun create() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
// LANGUAGE_LEVEL 1.8
|
||||||
|
// WITH_RUNTIME
|
||||||
|
// KOTLINC_EXTRA_OPTS -jvm-target, 1.8
|
||||||
Generated
+10
@@ -109,11 +109,21 @@ public class JavaAgainstKotlinBinariesCheckerTestGenerated extends AbstractJavaA
|
|||||||
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/InferenceReturnType_1_8.kt");
|
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/InferenceReturnType_1_8.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("Interface.kt")
|
||||||
|
public void testInterface() throws Exception {
|
||||||
|
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/Interface.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("InterfaceDefaultImpls.kt")
|
@TestMetadata("InterfaceDefaultImpls.kt")
|
||||||
public void testInterfaceDefaultImpls() throws Exception {
|
public void testInterfaceDefaultImpls() throws Exception {
|
||||||
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/InterfaceDefaultImpls.kt");
|
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/InterfaceDefaultImpls.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("InterfaceWithJvmStatic.kt")
|
||||||
|
public void testInterfaceWithJvmStatic() throws Exception {
|
||||||
|
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/InterfaceWithJvmStatic.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("JvmOverloadsFunctions.kt")
|
@TestMetadata("JvmOverloadsFunctions.kt")
|
||||||
public void testJvmOverloadsFunctions() throws Exception {
|
public void testJvmOverloadsFunctions() throws Exception {
|
||||||
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/JvmOverloadsFunctions.kt");
|
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/JvmOverloadsFunctions.kt");
|
||||||
|
|||||||
+10
@@ -111,11 +111,21 @@ public class JavaAgainstKotlinSourceCheckerTestGenerated extends AbstractJavaAga
|
|||||||
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/InferenceReturnType_1_8.kt");
|
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/InferenceReturnType_1_8.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("Interface.kt")
|
||||||
|
public void testInterface() throws Exception {
|
||||||
|
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/Interface.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("InterfaceDefaultImpls.kt")
|
@TestMetadata("InterfaceDefaultImpls.kt")
|
||||||
public void testInterfaceDefaultImpls() throws Exception {
|
public void testInterfaceDefaultImpls() throws Exception {
|
||||||
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/InterfaceDefaultImpls.kt");
|
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/InterfaceDefaultImpls.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("InterfaceWithJvmStatic.kt")
|
||||||
|
public void testInterfaceWithJvmStatic() throws Exception {
|
||||||
|
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/InterfaceWithJvmStatic.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("JvmOverloadsFunctions.kt")
|
@TestMetadata("JvmOverloadsFunctions.kt")
|
||||||
public void testJvmOverloadsFunctions() throws Exception {
|
public void testJvmOverloadsFunctions() throws Exception {
|
||||||
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/JvmOverloadsFunctions.kt");
|
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/JvmOverloadsFunctions.kt");
|
||||||
|
|||||||
+10
@@ -111,11 +111,21 @@ public class JavaAgainstKotlinSourceCheckerWithoutUltraLightTestGenerated extend
|
|||||||
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/InferenceReturnType_1_8.kt");
|
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/InferenceReturnType_1_8.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("Interface.kt")
|
||||||
|
public void testInterface() throws Exception {
|
||||||
|
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/Interface.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("InterfaceDefaultImpls.kt")
|
@TestMetadata("InterfaceDefaultImpls.kt")
|
||||||
public void testInterfaceDefaultImpls() throws Exception {
|
public void testInterfaceDefaultImpls() throws Exception {
|
||||||
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/InterfaceDefaultImpls.kt");
|
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/InterfaceDefaultImpls.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("InterfaceWithJvmStatic.kt")
|
||||||
|
public void testInterfaceWithJvmStatic() throws Exception {
|
||||||
|
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/InterfaceWithJvmStatic.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("JvmOverloadsFunctions.kt")
|
@TestMetadata("JvmOverloadsFunctions.kt")
|
||||||
public void testJvmOverloadsFunctions() throws Exception {
|
public void testJvmOverloadsFunctions() throws Exception {
|
||||||
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/JvmOverloadsFunctions.kt");
|
runTest("idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/JvmOverloadsFunctions.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user