Files
kotlin-fork/compiler/testData/diagnostics/tests/annotations/inheritFromAnnotationClass2.txt
T
Alexander Udalov 56a51c1d22 Do not treat annotation classes as interfaces in bridges codegen
From Kotlin's point of view, everything in annotation classes is
non-abstract. A class inheriting from an annotation has a non-abstract
fake override for each property of the annotation class constructor. But
because members of annotation classes themselves were considered as
abstract in the bridge-generating code (see
DescriptorBasedFunctionHandle.isAbstract), there was a situation where a
concrete fake override has only one declaration among overridden
descriptors and it was abstract. This situation is invalid (a concrete
fake override must have exactly one concrete super-declaration),
therefore an exception was thrown.

The fix is to avoid considering annotation class members abstract for
the purposes of bridge generation. It's reasonably safe because no
bridges should be ever generated for annotation subclasses anyway,
because annotations can only have members with simple return types
(final and non-generic).

Note that in KT-19928, the problem is reproducible because of an
incorrect "inexact analysis" in light classes where "Target" is resolved
to an annotation class kotlin.annotation.Target. This behavior of the
analysis in light classes seems to do no harm otherwise, so it's not a
goal of this commit to change anything in that regard

 #KT-19928 Fixed
2017-11-02 14:02:09 +01:00

43 lines
1.9 KiB
Plaintext
Vendored

package
public final annotation class Ann : kotlin.annotation.Target {
public constructor Ann()
public final override /*1*/ /*fake_override*/ val allowedTargets: kotlin.Array<out kotlin.annotation.AnnotationTarget>
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 Ann2 : kotlin.annotation.Target {
public constructor Ann2(/*0*/ vararg allowedTargets: kotlin.annotation.AnnotationTarget /*kotlin.Array<out kotlin.annotation.AnnotationTarget>*/)
public final override /*1*/ val allowedTargets: kotlin.Array<out kotlin.annotation.AnnotationTarget>
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 Ann3 : C {
public constructor Ann3()
public final override /*1*/ /*fake_override*/ fun bar(): kotlin.collections.Set<kotlin.Number>
public open override /*1*/ /*fake_override*/ fun foo(): kotlin.collections.List<kotlin.String>
}
public final annotation class Ann4 : I {
public constructor Ann4()
public open override /*1*/ /*fake_override*/ fun foo(): kotlin.collections.List<kotlin.String>
}
public final class C : I {
public constructor C()
public final fun bar(): kotlin.collections.Set<kotlin.Number>
public open override /*1*/ /*fake_override*/ fun foo(): kotlin.collections.List<kotlin.String>
}
public interface I : J {
public open override /*1*/ fun foo(): kotlin.collections.List<kotlin.String>
}
public interface J : Target {
public abstract fun foo(): kotlin.collections.(Mutable)Collection<kotlin.String!>!
}