Provide more clear API around AnnotationChecker.applicableTargetSet
This commit is contained in:
committed by
TeamCityServer
parent
19ab0ab2f8
commit
255eb87375
+1
-1
@@ -50,7 +50,7 @@ object FileClassAnnotationsChecker : AdditionalAnnotationChecker {
|
||||
val descriptor = trace.get(BindingContext.ANNOTATION, entry) ?: continue
|
||||
val classDescriptor = descriptor.annotationClass ?: continue
|
||||
// This check matters for the applicable annotations only.
|
||||
val applicableTargets = AnnotationChecker.applicableTargetSet(classDescriptor)
|
||||
val applicableTargets = AnnotationChecker.applicableTargetSetFromTargetAnnotationOrNull(classDescriptor)
|
||||
if (applicableTargets == null || !applicableTargets.contains(KotlinTarget.FILE)) continue
|
||||
fileAnnotationsToCheck.add(Pair(entry, classDescriptor))
|
||||
}
|
||||
|
||||
+2
-2
@@ -205,8 +205,8 @@ class RepeatableAnnotationChecker(
|
||||
annotationClass: ClassDescriptor,
|
||||
reportOn: KtAnnotationEntry,
|
||||
): Diagnostic? {
|
||||
val annotationTargets = AnnotationChecker.applicableTargetSet(annotationClass) ?: KotlinTarget.DEFAULT_TARGET_SET
|
||||
val containerTargets = AnnotationChecker.applicableTargetSet(containerClass) ?: KotlinTarget.DEFAULT_TARGET_SET
|
||||
val annotationTargets = AnnotationChecker.applicableTargetSet(annotationClass)
|
||||
val containerTargets = AnnotationChecker.applicableTargetSet(containerClass)
|
||||
|
||||
// See https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-9.6.3.
|
||||
// (TBH, the rules about TYPE/TYPE_USE and TYPE_PARAMETER/TYPE_USE don't seem to make a lot of sense, but it's JLS
|
||||
|
||||
Reference in New Issue
Block a user