Minor. Move BinaryJavaModifierListOwner -> MapBasedJavaAnnotationOwner
This commit is contained in:
+1
-1
@@ -38,7 +38,7 @@ class BinaryJavaClass(
|
|||||||
override var access: Int = 0,
|
override var access: Int = 0,
|
||||||
override val outerClass: JavaClass?,
|
override val outerClass: JavaClass?,
|
||||||
classContent: ByteArray? = null
|
classContent: ByteArray? = null
|
||||||
) : ClassVisitor(ASM_API_VERSION_FOR_CLASS_READING), VirtualFileBoundJavaClass, BinaryJavaModifierListOwner, BinaryJavaAnnotationOwner {
|
) : ClassVisitor(ASM_API_VERSION_FOR_CLASS_READING), VirtualFileBoundJavaClass, BinaryJavaModifierListOwner, MapBasedJavaAnnotationOwner {
|
||||||
lateinit var myInternalName: String
|
lateinit var myInternalName: String
|
||||||
|
|
||||||
override val annotations: MutableCollection<JavaAnnotation> = mutableListOf()
|
override val annotations: MutableCollection<JavaAnnotation> = mutableListOf()
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ abstract class BinaryJavaMethodBase(
|
|||||||
val valueParameters: List<JavaValueParameter>,
|
val valueParameters: List<JavaValueParameter>,
|
||||||
val typeParameters: List<JavaTypeParameter>,
|
val typeParameters: List<JavaTypeParameter>,
|
||||||
override val name: Name
|
override val name: Name
|
||||||
) : JavaMember, BinaryJavaAnnotationOwner, BinaryJavaModifierListOwner {
|
) : JavaMember, MapBasedJavaAnnotationOwner, BinaryJavaModifierListOwner {
|
||||||
override val annotationsByFqName by buildLazyValueForMap()
|
override val annotationsByFqName by buildLazyValueForMap()
|
||||||
|
|
||||||
override val annotations: Collection<JavaAnnotation> = mutableListOf()
|
override val annotations: Collection<JavaAnnotation> = mutableListOf()
|
||||||
|
|||||||
+2
-2
@@ -30,7 +30,7 @@ class BinaryJavaField(
|
|||||||
override val isEnumEntry: Boolean,
|
override val isEnumEntry: Boolean,
|
||||||
override val type: JavaType,
|
override val type: JavaType,
|
||||||
override val initializerValue: Any?
|
override val initializerValue: Any?
|
||||||
) : JavaField, BinaryJavaAnnotationOwner, BinaryJavaModifierListOwner {
|
) : JavaField, MapBasedJavaAnnotationOwner, BinaryJavaModifierListOwner {
|
||||||
override val annotations: MutableCollection<JavaAnnotation> = ContainerUtil.newSmartList()
|
override val annotations: MutableCollection<JavaAnnotation> = ContainerUtil.newSmartList()
|
||||||
override val annotationsByFqName by buildLazyValueForMap()
|
override val annotationsByFqName by buildLazyValueForMap()
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ class BinaryJavaValueParameter(
|
|||||||
override val name: Name?,
|
override val name: Name?,
|
||||||
override val type: JavaType,
|
override val type: JavaType,
|
||||||
override val isVararg: Boolean
|
override val isVararg: Boolean
|
||||||
) : JavaValueParameter, BinaryJavaAnnotationOwner {
|
) : JavaValueParameter, MapBasedJavaAnnotationOwner {
|
||||||
override val annotations: MutableCollection<JavaAnnotation> = ContainerUtil.newSmartList()
|
override val annotations: MutableCollection<JavaAnnotation> = ContainerUtil.newSmartList()
|
||||||
override val annotationsByFqName by buildLazyValueForMap()
|
override val annotationsByFqName by buildLazyValueForMap()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-15
@@ -19,22 +19,13 @@ package org.jetbrains.kotlin.load.java.structure.impl.classFiles
|
|||||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
import org.jetbrains.kotlin.load.java.JavaVisibilities
|
import org.jetbrains.kotlin.load.java.JavaVisibilities
|
||||||
import org.jetbrains.kotlin.load.java.structure.JavaAnnotation
|
|
||||||
import org.jetbrains.kotlin.load.java.structure.JavaAnnotationOwner
|
|
||||||
import org.jetbrains.kotlin.load.java.structure.JavaModifierListOwner
|
import org.jetbrains.kotlin.load.java.structure.JavaModifierListOwner
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.load.java.structure.MapBasedJavaAnnotationOwner
|
||||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||||
|
|
||||||
internal val ASM_API_VERSION_FOR_CLASS_READING = Opcodes.ASM5
|
internal val ASM_API_VERSION_FOR_CLASS_READING = Opcodes.ASM5
|
||||||
|
|
||||||
internal interface BinaryJavaAnnotationOwner : JavaAnnotationOwner {
|
internal interface BinaryJavaModifierListOwner : JavaModifierListOwner, MapBasedJavaAnnotationOwner {
|
||||||
val annotationsByFqName: Map<FqName, JavaAnnotation>
|
|
||||||
override fun findAnnotation(fqName: FqName) = annotationsByFqName[fqName]
|
|
||||||
override val isDeprecatedInJavaDoc: Boolean
|
|
||||||
get() = false
|
|
||||||
}
|
|
||||||
|
|
||||||
internal interface BinaryJavaModifierListOwner : JavaModifierListOwner, BinaryJavaAnnotationOwner {
|
|
||||||
val access: Int
|
val access: Int
|
||||||
|
|
||||||
fun isSet(flag: Int) = access.isSet(flag)
|
fun isSet(flag: Int) = access.isSet(flag)
|
||||||
@@ -54,8 +45,4 @@ internal interface BinaryJavaModifierListOwner : JavaModifierListOwner, BinaryJa
|
|||||||
override val isDeprecatedInJavaDoc get() = isSet(Opcodes.ACC_DEPRECATED)
|
override val isDeprecatedInJavaDoc get() = isSet(Opcodes.ACC_DEPRECATED)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun JavaAnnotationOwner.buildLazyValueForMap() = lazy {
|
|
||||||
annotations.filter { it.classId != null }.associateBy({ it.classId!!.asSingleFqName() }, { it })
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun Int.isSet(flag: Int) = this and flag != 0
|
internal fun Int.isSet(flag: Int) = this and flag != 0
|
||||||
|
|||||||
+11
-1
@@ -52,7 +52,17 @@ interface JavaAnnotation : JavaElement {
|
|||||||
fun resolve(): JavaClass?
|
fun resolve(): JavaClass?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface JavaPackage : JavaElement {
|
interface MapBasedJavaAnnotationOwner : JavaAnnotationOwner {
|
||||||
|
val annotationsByFqName: Map<FqName?, JavaAnnotation>
|
||||||
|
override fun findAnnotation(fqName: FqName) = annotationsByFqName[fqName]
|
||||||
|
override val isDeprecatedInJavaDoc: Boolean
|
||||||
|
get() = false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun JavaAnnotationOwner.buildLazyValueForMap() = lazy {
|
||||||
|
annotations.associateBy { it.classId?.asSingleFqName() }
|
||||||
|
}
|
||||||
|
|
||||||
val fqName: FqName
|
val fqName: FqName
|
||||||
val subPackages: Collection<JavaPackage>
|
val subPackages: Collection<JavaPackage>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user