mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
java type annotations: treat nullability annotations as type_use to avoid reordering of a modifier list (IDEA-206570)
GitOrigin-RevId: 292b1052c44815db83d6033a30b44e56c8b4fa34
This commit is contained in:
committed by
intellij-monorepo-bot
parent
38ed3bacc6
commit
a5278f0dbb
@@ -280,7 +280,8 @@ public final class AnnotationTargetUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefers "normal" target when type use annotation appears at the place where it's also applicable
|
||||
* Prefers "normal" target when type use annotation appears at the place where it's also applicable.
|
||||
* Treat nullability annotations as TYPE_USE: we need to copy these annotations otherwise, and then the place of the annotation in modifier list may differ
|
||||
*
|
||||
* @param modifierList the place where annotation appears
|
||||
*
|
||||
@@ -298,6 +299,7 @@ public final class AnnotationTargetUtil {
|
||||
Set<PsiAnnotation.TargetType> targets = getAnnotationTargets(annotationClass);
|
||||
if (targets != null && targets.contains(PsiAnnotation.TargetType.TYPE_USE) &&
|
||||
(targets.size() == 1 ||
|
||||
NullableNotNullManager.isNullabilityAnnotation(annotation) ||
|
||||
!ContainerUtil.exists(getTargetsForLocation(modifierList),
|
||||
target -> target != PsiAnnotation.TargetType.TYPE_USE && targets.contains(target)))) {
|
||||
return true;
|
||||
|
||||
@@ -9,9 +9,8 @@ abstract class Foo<T> {
|
||||
|
||||
class FooImpl extends Foo<String> {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getSmth() {
|
||||
public @Nullable String getSmth() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user