Support package level annotations in Java
#KT-10942 In Progress
This commit is contained in:
+6
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.SourceElement
|
||||
import org.jetbrains.kotlin.descriptors.impl.PackageFragmentDescriptorImpl
|
||||
import org.jetbrains.kotlin.load.java.lazy.LazyJavaResolverContext
|
||||
import org.jetbrains.kotlin.load.java.lazy.resolveAnnotations
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaClass
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaPackage
|
||||
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryPackageSourceElement
|
||||
@@ -48,6 +49,11 @@ class LazyJavaPackageFragment(
|
||||
onRecursiveCall = listOf()
|
||||
)
|
||||
|
||||
private val packageAnnotations = c.resolveAnnotations(jPackage)
|
||||
|
||||
// Test only method
|
||||
fun getPackageAnnotations() = packageAnnotations
|
||||
|
||||
internal fun getSubPackageFqNames(): List<FqName> = subPackages()
|
||||
|
||||
internal fun findClassifierByJavaClass(jClass: JavaClass): ClassDescriptor? = scope.javaScope.findClassifierByJavaClass(jClass)
|
||||
|
||||
+1
@@ -63,6 +63,7 @@ fun JavaAnnotationOwner.buildLazyValueForMap() = lazy {
|
||||
annotations.associateBy { it.classId?.asSingleFqName() }
|
||||
}
|
||||
|
||||
interface JavaPackage : JavaElement, JavaAnnotationOwner {
|
||||
val fqName: FqName
|
||||
val subPackages: Collection<JavaPackage>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user