From 0b252505d975756d905c1fe885c05bf040475028 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 1 Apr 2015 19:30:20 +0300 Subject: [PATCH] Minor, add clarifying comment & inline useless property --- .../java/structure/reflect/ReflectJavaAnnotationOwner.kt | 2 +- .../kotlin/load/java/structure/reflect/ReflectJavaClass.kt | 2 +- .../kotlin/load/java/structure/reflect/reflectClassUtil.kt | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) 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")