Support preference of TYPE_USE annotations to enhance over others like METHOD, FIELD and VALUE_PARAMETER to avoid double applying them in case of arrays: @NotNull Integer [] (both to the array element and to the entire array)

^KT-24392 Fixed
This commit is contained in:
Victor Petukhov
2020-12-08 18:32:33 +03:00
parent 69f31afecc
commit 857cc92326
8 changed files with 83 additions and 47 deletions
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.nj2k.conversions
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
import org.jetbrains.kotlin.nj2k.NewJ2kConverterContext
import org.jetbrains.kotlin.nj2k.tree.*
@@ -30,7 +31,7 @@ class JavaAnnotationsConversion(context: NewJ2kConverterContext) : RecursiveAppl
annotation.classSymbol = symbolProvider.provideClassSymbol("kotlin.Deprecated")
annotation.arguments = listOf(JKAnnotationParameterImpl(JKLiteralExpression("\"\"", JKLiteralExpression.LiteralType.STRING)))
}
if (annotation.classSymbol.fqName == "java.lang.annotation.Target") {
if (annotation.classSymbol.fqName == JvmAnnotationNames.TARGET_ANNOTATION.asString()) {
annotation.classSymbol = symbolProvider.provideClassSymbol("kotlin.annotation.Target")
val arguments = annotation.arguments.singleOrNull()?.let { parameter ->