New J2K: Fix not converted jetbrains nullability annotations for types
it became broken after annotation started to be assigned to type elements
instead of declarations after 4da7d11
#KT-34987 fixed
This commit is contained in:
+7
-8
@@ -21,14 +21,13 @@ class JetbrainsNullableAnnotationsConverter(context: NewJ2kConverterContext) : R
|
||||
for (annotation in element.annotationList.annotations) {
|
||||
val nullability = annotation.annotationNullability() ?: continue
|
||||
when (element) {
|
||||
is JKVariable -> {
|
||||
annotationsToRemove += annotation
|
||||
element.type = JKTypeElement(element.type.type.updateNullability(nullability))
|
||||
}
|
||||
is JKMethod -> {
|
||||
annotationsToRemove += annotation
|
||||
element.returnType = JKTypeElement(element.returnType.type.updateNullability(nullability))
|
||||
}
|
||||
is JKVariable -> element.type
|
||||
is JKMethod -> element.returnType
|
||||
is JKTypeElement -> element
|
||||
else -> null
|
||||
}?.let { typeElement ->
|
||||
annotationsToRemove += annotation
|
||||
typeElement.type = typeElement.type.updateNullability(nullability)
|
||||
}
|
||||
}
|
||||
element.annotationList.annotations -= annotationsToRemove
|
||||
|
||||
Reference in New Issue
Block a user