diff --git a/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/ReflectJavaAnnotationOwner.kt b/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/ReflectJavaAnnotationOwner.kt index 78843c3d9c0..bfe01d7de74 100644 --- a/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/ReflectJavaAnnotationOwner.kt +++ b/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/ReflectJavaAnnotationOwner.kt @@ -33,5 +33,5 @@ fun getAnnotations(annotations: Array): List } fun findAnnotation(annotations: Array, fqName: FqName): ReflectJavaAnnotation? { - return annotations.firstOrNull { it.annotationType().fqName == fqName }?.let { ReflectJavaAnnotation(it) } + return annotations.firstOrNull { it.annotationType().classId.asSingleFqName() == fqName }?.let { ReflectJavaAnnotation(it) } } diff --git a/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/ReflectJavaClass.kt b/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/ReflectJavaClass.kt index 4c74b6f33cd..dfa68e49b79 100644 --- a/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/ReflectJavaClass.kt +++ b/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/ReflectJavaClass.kt @@ -44,7 +44,7 @@ public class ReflectJavaClass( .map(::ReflectJavaClass) .toList() - override fun getFqName() = klass.fqName + override fun getFqName() = klass.classId.asSingleFqName() override fun getOuterClass() = klass.getDeclaringClass()?.let(::ReflectJavaClass) diff --git a/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/reflectClassUtil.kt b/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/reflectClassUtil.kt index 03df4b3f33c..7776651f54d 100644 --- a/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/reflectClassUtil.kt +++ b/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/reflectClassUtil.kt @@ -27,9 +27,9 @@ public val Class<*>.classLoader: ClassLoader public fun Class<*>.isEnumClassOrSpecializedEnumEntryClass(): Boolean = javaClass>().isAssignableFrom(this) -public val Class<*>.fqName: FqName - get() = classId.asSingleFqName() - +/** + * NOTE: does not perform a Java -> Kotlin mapping. If this is not expected, consider using KClassImpl#classId instead + */ public val Class<*>.classId: ClassId get() = when { isPrimitive() -> throw IllegalArgumentException("Can't compute ClassId for primitive type: $this")