Mark freshly supported annotations to use that mark for reporting corresponding warnings
This commit is contained in:
+6
-2
@@ -45,14 +45,18 @@ object JavaAnnotationMapper {
|
||||
internal val TARGET_ANNOTATION_ALLOWED_TARGETS = Name.identifier("allowedTargets")
|
||||
internal val RETENTION_ANNOTATION_VALUE = Name.identifier("value")
|
||||
|
||||
fun mapOrResolveJavaAnnotation(annotation: JavaAnnotation, c: LazyJavaResolverContext): AnnotationDescriptor? =
|
||||
fun mapOrResolveJavaAnnotation(
|
||||
annotation: JavaAnnotation,
|
||||
c: LazyJavaResolverContext,
|
||||
isFreshlySupportedAnnotation: Boolean = false
|
||||
): AnnotationDescriptor? =
|
||||
when (annotation.classId) {
|
||||
ClassId.topLevel(TARGET_ANNOTATION) -> JavaTargetAnnotationDescriptor(annotation, c)
|
||||
ClassId.topLevel(RETENTION_ANNOTATION) -> JavaRetentionAnnotationDescriptor(annotation, c)
|
||||
ClassId.topLevel(REPEATABLE_ANNOTATION) -> JavaAnnotationDescriptor(c, annotation, StandardNames.FqNames.repeatable)
|
||||
ClassId.topLevel(DOCUMENTED_ANNOTATION) -> JavaAnnotationDescriptor(c, annotation, StandardNames.FqNames.mustBeDocumented)
|
||||
ClassId.topLevel(DEPRECATED_ANNOTATION) -> null
|
||||
else -> LazyJavaAnnotationDescriptor(c, annotation)
|
||||
else -> LazyJavaAnnotationDescriptor(c, annotation, isFreshlySupportedAnnotation)
|
||||
}
|
||||
|
||||
fun findMappedJavaAnnotation(
|
||||
|
||||
+4
-1
@@ -39,7 +39,8 @@ import org.jetbrains.kotlin.types.isError
|
||||
|
||||
class LazyJavaAnnotationDescriptor(
|
||||
private val c: LazyJavaResolverContext,
|
||||
private val javaAnnotation: JavaAnnotation
|
||||
private val javaAnnotation: JavaAnnotation,
|
||||
isFreshlySupportedAnnotation: Boolean = false
|
||||
) : AnnotationDescriptor, PossiblyExternalAnnotationDescriptor {
|
||||
override val fqName by c.storageManager.createNullableLazyValue {
|
||||
javaAnnotation.classId?.asSingleFqName()
|
||||
@@ -115,4 +116,6 @@ class LazyJavaAnnotationDescriptor(
|
||||
)
|
||||
|
||||
override val isIdeExternalAnnotation: Boolean = javaAnnotation.isIdeExternalAnnotation
|
||||
|
||||
val isFreshlySupportedTypeUseAnnotation: Boolean = javaAnnotation.isFreshlySupportedTypeUseAnnotation || isFreshlySupportedAnnotation
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user