Wrong specialization diagnostic is reported on java default inheritance
This commit is contained in:
+1
-1
@@ -154,7 +154,7 @@ class JvmDefaultChecker(val jvmTarget: JvmTarget, project: Project) : Declaratio
|
|||||||
declaration: KtDeclaration,
|
declaration: KtDeclaration,
|
||||||
performSpecializationCheck: Boolean
|
performSpecializationCheck: Boolean
|
||||||
): Boolean {
|
): Boolean {
|
||||||
if (!performSpecializationCheck) return true
|
if (!performSpecializationCheck || actualImplementation is JavaMethodDescriptor) return true
|
||||||
val inheritedSignature = inheritedFun.computeJvmDescriptor(withReturnType = true, withName = false)
|
val inheritedSignature = inheritedFun.computeJvmDescriptor(withReturnType = true, withName = false)
|
||||||
val originalImplementation = actualImplementation.original
|
val originalImplementation = actualImplementation.original
|
||||||
val actualSignature = originalImplementation.computeJvmDescriptor(withReturnType = true, withName = false)
|
val actualSignature = originalImplementation.computeJvmDescriptor(withReturnType = true, withName = false)
|
||||||
|
|||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package test;
|
||||||
|
|
||||||
|
public interface JavaInterface<T> {
|
||||||
|
default T test(T p) {
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package test;
|
||||||
|
|
||||||
|
public interface JavaInterface2<T> extends JavaInterface<T> {
|
||||||
|
|
||||||
|
}
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
OK
|
||||||
Vendored
+25
@@ -0,0 +1,25 @@
|
|||||||
|
import test.*
|
||||||
|
|
||||||
|
interface KotlinInterface<K> : JavaInterface<String> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
interface KotlinInterface2 : JavaInterface2<String> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
open class KotlinClass : JavaInterface<String> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
open class KotlinClass2 : JavaInterface2<String> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
open class KotlinClass_2 : KotlinClass() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
open class KotlinClass2_2 : KotlinClass2() {
|
||||||
|
|
||||||
|
}
|
||||||
+5
@@ -632,6 +632,11 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
|
|||||||
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-jvm-target", "1.8", "-Xjvm-default=all"))
|
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-jvm-target", "1.8", "-Xjvm-default=all"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun testJvmDefaultCompatibilityAgainstJava() {
|
||||||
|
val library = compileLibrary("library", additionalOptions = listOf("-Xjvm-default=disable"))
|
||||||
|
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-jvm-target", "1.8", "-Xjvm-default=all-compatibility"))
|
||||||
|
}
|
||||||
|
|
||||||
fun testInternalFromForeignModuleJs() {
|
fun testInternalFromForeignModuleJs() {
|
||||||
compileKotlin("source.kt", File(tmpdir, "usage.js"), listOf(compileJsLibrary("library")), K2JSCompiler())
|
compileKotlin("source.kt", File(tmpdir, "usage.js"), listOf(compileJsLibrary("library")), K2JSCompiler())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user