Drop Annotations.getAllAnnotations
This commit is contained in:
+12
-10
@@ -92,14 +92,7 @@ class AnnotationSplitter(
|
||||
val applicableTargets = applicableTargetsLazy()
|
||||
val applicableTargetsWithoutUseSiteTarget = applicableTargets.intersect(TARGET_PRIORITIES)
|
||||
|
||||
outer@ for ((annotation, useSiteTarget) in allAnnotations.getAllAnnotations()) {
|
||||
if (useSiteTarget != null) {
|
||||
if (useSiteTarget in applicableTargets)
|
||||
map.getOrPut(useSiteTarget) { arrayListOf() }.add(annotation)
|
||||
|
||||
continue@outer
|
||||
}
|
||||
|
||||
outer@ for (annotation in allAnnotations) {
|
||||
for (target in TARGET_PRIORITIES) {
|
||||
if (target !in applicableTargetsWithoutUseSiteTarget) continue
|
||||
|
||||
@@ -115,6 +108,14 @@ class AnnotationSplitter(
|
||||
other.add(annotation)
|
||||
}
|
||||
|
||||
for ((annotation, useSiteTarget) in allAnnotations.getUseSiteTargetedAnnotations()) {
|
||||
if (useSiteTarget == null) continue
|
||||
|
||||
if (useSiteTarget in applicableTargets) {
|
||||
map.getOrPut(useSiteTarget) { arrayListOf() }.add(annotation)
|
||||
}
|
||||
}
|
||||
|
||||
map to AnnotationsImpl(other)
|
||||
}
|
||||
|
||||
@@ -137,14 +138,15 @@ class AnnotationSplitter(
|
||||
}
|
||||
|
||||
override fun forceResolveAllContents() {
|
||||
getAllAnnotations()
|
||||
for (annotation in this) {
|
||||
// TODO: probably we should do ForceResolveUtil.forceResolveAllContents(annotation) here
|
||||
}
|
||||
}
|
||||
|
||||
override fun isEmpty() = annotations.isEmpty()
|
||||
override fun hasAnnotation(fqName: FqName) = annotations.hasAnnotation(fqName)
|
||||
override fun findAnnotation(fqName: FqName) = annotations.findAnnotation(fqName)
|
||||
override fun getUseSiteTargetedAnnotations() = annotations.getUseSiteTargetedAnnotations()
|
||||
override fun getAllAnnotations() = annotations.getAllAnnotations()
|
||||
override fun iterator() = annotations.iterator()
|
||||
override fun toString() = annotations.toString()
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationWithTarget;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
@@ -64,8 +64,8 @@ public class ForceResolveUtil {
|
||||
|
||||
public static void forceResolveAllContents(@NotNull Annotations annotations) {
|
||||
doForceResolveAllContents(annotations);
|
||||
for (AnnotationWithTarget annotationWithTarget : annotations.getAllAnnotations()) {
|
||||
doForceResolveAllContents(annotationWithTarget.getAnnotation());
|
||||
for (AnnotationDescriptor annotation : annotations) {
|
||||
doForceResolveAllContents(annotation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -56,7 +56,6 @@ class LazyAnnotations(
|
||||
override fun isEmpty() = annotationEntries.isEmpty()
|
||||
|
||||
private val annotation = c.storageManager.createMemoizedFunction { entry: KtAnnotationEntry ->
|
||||
|
||||
val descriptor = LazyAnnotationDescriptor(c, entry)
|
||||
val target = entry.useSiteTarget?.getAnnotationUseSiteTarget()
|
||||
AnnotationWithTarget(descriptor, target)
|
||||
@@ -70,8 +69,6 @@ class LazyAnnotations(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getAllAnnotations() = annotationEntries.map(annotation)
|
||||
|
||||
override fun iterator(): Iterator<AnnotationDescriptor> {
|
||||
return annotationEntries
|
||||
.asSequence()
|
||||
@@ -83,7 +80,9 @@ class LazyAnnotations(
|
||||
|
||||
override fun forceResolveAllContents() {
|
||||
// To resolve all entries
|
||||
getAllAnnotations()
|
||||
for (annotation in this) {
|
||||
// TODO: probably we should do ForceResolveUtil.forceResolveAllContents(annotation) here
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user