Kapt: Fix supertype conversion for DefaultImpls (KT-28306)
This commit is contained in:
+5
@@ -425,6 +425,11 @@ class ClassFileToSourceStubConverter(val kaptContext: KaptContextForStubGenerati
|
||||
}
|
||||
|
||||
val declaration = kaptContext.origins[clazz]?.element as? KtClassOrObject ?: return defaultSuperTypes
|
||||
val declarationDescriptor = kaptContext.bindingContext[BindingContext.CLASS, declaration] ?: return defaultSuperTypes
|
||||
|
||||
if (typeMapper.mapType(declarationDescriptor) != Type.getObjectType(clazz.name)) {
|
||||
return defaultSuperTypes
|
||||
}
|
||||
|
||||
val (superClass, superInterfaces) = partitionSuperTypes(declaration) ?: return defaultSuperTypes
|
||||
|
||||
|
||||
+5
@@ -269,6 +269,11 @@ public class ClassFileToSourceStubConverterTestGenerated extends AbstractClassFi
|
||||
runTest("plugins/kapt3/kapt3-compiler/testData/converter/kt27126.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt28306.kt")
|
||||
public void testKt28306() throws Exception {
|
||||
runTest("plugins/kapt3/kapt3-compiler/testData/converter/kt28306.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lazyProperty.kt")
|
||||
public void testLazyProperty() throws Exception {
|
||||
runTest("plugins/kapt3/kapt3-compiler/testData/converter/lazyProperty.kt");
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// CORRECT_ERROR_TYPES
|
||||
|
||||
package foo
|
||||
|
||||
interface InterfaceWithDefaults<T> {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
interface SubInterface<T> : InterfaceWithDefaults<T>
|
||||
@@ -0,0 +1,42 @@
|
||||
package foo;
|
||||
|
||||
import java.lang.System;
|
||||
|
||||
@kotlin.Metadata()
|
||||
public abstract interface InterfaceWithDefaults<T extends java.lang.Object> {
|
||||
|
||||
public abstract void foo();
|
||||
|
||||
@kotlin.Metadata()
|
||||
public static final class DefaultImpls {
|
||||
|
||||
public DefaultImpls() {
|
||||
super();
|
||||
}
|
||||
|
||||
public static <T extends java.lang.Object>void foo(foo.InterfaceWithDefaults<T> $this) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
package foo;
|
||||
|
||||
import java.lang.System;
|
||||
|
||||
@kotlin.Metadata()
|
||||
public abstract interface SubInterface<T extends java.lang.Object> extends foo.InterfaceWithDefaults<T> {
|
||||
|
||||
@kotlin.Metadata()
|
||||
public static final class DefaultImpls {
|
||||
|
||||
public DefaultImpls() {
|
||||
super();
|
||||
}
|
||||
|
||||
@java.lang.Override()
|
||||
public static <T extends java.lang.Object>void foo(foo.SubInterface<T> $this) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user