mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
[java-psi] PsiModifierListImpl: put new keyword next to the existing one
Avoid having annotations between modifiers Fixes IDEA-274153 Make final inspection nullability issue GitOrigin-RevId: 19d44fc864f5be2c3ca39460744620f6c21bf074
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4d201ad256
commit
03232bfa8d
@@ -74,13 +74,17 @@ public class ModifierListElement extends CompositeElement {
|
||||
private static ASTNode getDefaultAnchor(PsiModifierList modifierList, PsiKeyword modifier) {
|
||||
Integer order = ourModifierToOrderMap.get(modifier.getText());
|
||||
if (order == null) return null;
|
||||
boolean hasKeyword = false;
|
||||
for (ASTNode child = SourceTreeToPsiMap.psiToTreeNotNull(modifierList).getFirstChildNode(); child != null; child = child.getTreeNext()) {
|
||||
if (ElementType.KEYWORD_BIT_SET.contains(child.getElementType())) {
|
||||
hasKeyword = true;
|
||||
Integer order1 = ourModifierToOrderMap.get(child.getText());
|
||||
if (order1 == null) continue;
|
||||
if (order1.intValue() > order.intValue()) {
|
||||
return child;
|
||||
}
|
||||
} else if (child.getElementType() == JavaElementType.ANNOTATION && hasKeyword) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Make 'foo' static" "true"
|
||||
import java.lang.annotation.*;
|
||||
|
||||
interface I {
|
||||
public static @Anno int foo() {
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
@Target(ElementType.TYPE_USE)
|
||||
@interface Anno {}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Make 'foo' static" "true"
|
||||
import java.lang.annotation.*;
|
||||
|
||||
interface I {
|
||||
public @Anno int f<caret>oo() {
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
@Target(ElementType.TYPE_USE)
|
||||
@interface Anno {}
|
||||
Reference in New Issue
Block a user