Refine ClassDescriptor::isCommonFinalClass definition
Do not treat annotations as final classes as they are not final in Java #KT-20776 Fixed
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// FILE: MyAnnotation.java
|
||||
public @interface MyAnnotation {
|
||||
}
|
||||
// FILE: MyAnnoClass.java
|
||||
public class MyAnnoClass implements MyAnnotation {
|
||||
//...
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
val ann: MyAnnotation = MyAnnoClass()
|
||||
|
||||
fun foo(x: MyAnnoClass) {
|
||||
bar(x)
|
||||
}
|
||||
|
||||
fun bar(y: MyAnnotation) {
|
||||
y.hashCode()
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package
|
||||
|
||||
public val ann: MyAnnotation
|
||||
public fun bar(/*0*/ y: MyAnnotation): kotlin.Unit
|
||||
public fun foo(/*0*/ x: MyAnnoClass): kotlin.Unit
|
||||
|
||||
public open class MyAnnoClass : MyAnnotation {
|
||||
public constructor MyAnnoClass()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final annotation class MyAnnotation : kotlin.Annotation {
|
||||
public constructor MyAnnotation()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -12256,6 +12256,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("annotationsInheritance.kt")
|
||||
public void testAnnotationsInheritance() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/annotationsInheritance.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("arrayOfStarParametrized.kt")
|
||||
public void testArrayOfStarParametrized() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/arrayOfStarParametrized.kt");
|
||||
|
||||
+6
@@ -12256,6 +12256,12 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("annotationsInheritance.kt")
|
||||
public void testAnnotationsInheritance() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/annotationsInheritance.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("arrayOfStarParametrized.kt")
|
||||
public void testArrayOfStarParametrized() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/arrayOfStarParametrized.kt");
|
||||
|
||||
@@ -320,7 +320,7 @@ object NewKotlinTypeChecker : KotlinTypeChecker {
|
||||
}
|
||||
|
||||
private val ClassDescriptor.isCommonFinalClass: Boolean
|
||||
get() = isFinalClass && kind != ClassKind.ENUM_ENTRY
|
||||
get() = isFinalClass && kind != ClassKind.ENUM_ENTRY && kind != ClassKind.ANNOTATION_CLASS
|
||||
|
||||
/**
|
||||
* If we have several paths to some interface, we should prefer pure kotlin path.
|
||||
|
||||
Reference in New Issue
Block a user