Minor, add clarifying comment & inline useless property

This commit is contained in:
Alexander Udalov
2015-04-01 19:30:20 +03:00
parent 57be11a7e6
commit 0b252505d9
3 changed files with 5 additions and 5 deletions
@@ -33,5 +33,5 @@ fun getAnnotations(annotations: Array<Annotation>): List<ReflectJavaAnnotation>
}
fun findAnnotation(annotations: Array<Annotation>, fqName: FqName): ReflectJavaAnnotation? {
return annotations.firstOrNull { it.annotationType().fqName == fqName }?.let { ReflectJavaAnnotation(it) }
return annotations.firstOrNull { it.annotationType().classId.asSingleFqName() == fqName }?.let { ReflectJavaAnnotation(it) }
}
@@ -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)
@@ -27,9 +27,9 @@ public val Class<*>.classLoader: ClassLoader
public fun Class<*>.isEnumClassOrSpecializedEnumEntryClass(): Boolean =
javaClass<Enum<*>>().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")