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) {
|
for (annotation in element.annotationList.annotations) {
|
||||||
val nullability = annotation.annotationNullability() ?: continue
|
val nullability = annotation.annotationNullability() ?: continue
|
||||||
when (element) {
|
when (element) {
|
||||||
is JKVariable -> {
|
is JKVariable -> element.type
|
||||||
annotationsToRemove += annotation
|
is JKMethod -> element.returnType
|
||||||
element.type = JKTypeElement(element.type.type.updateNullability(nullability))
|
is JKTypeElement -> element
|
||||||
}
|
else -> null
|
||||||
is JKMethod -> {
|
}?.let { typeElement ->
|
||||||
annotationsToRemove += annotation
|
annotationsToRemove += annotation
|
||||||
element.returnType = JKTypeElement(element.returnType.type.updateNullability(nullability))
|
typeElement.type = typeElement.type.updateNullability(nullability)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
element.annotationList.annotations -= annotationsToRemove
|
element.annotationList.annotations -= annotationsToRemove
|
||||||
|
|||||||
Reference in New Issue
Block a user