mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
IJ-MR-136429 [java-generation] IDEA-344399 generate annotation based on type_use option
- fix message - fix comparator GitOrigin-RevId: 842fbf9e29150159ae92a47eddb84eb9a8d7288a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9bf2727703
commit
e42c3ee1e4
@@ -377,17 +377,15 @@ public final class GenerateMembersUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Comparator<PsiAnnotation> comparator = (a1, a2) -> {
|
Comparator<PsiAnnotation> comparator = Comparator.comparingInt(a -> {
|
||||||
String q1 = a1.getQualifiedName();
|
String q = a.getQualifiedName();
|
||||||
String q2 = a2.getQualifiedName();
|
if (q == null) return -1;
|
||||||
if (q1 == null || q2 == null) return 0;
|
PsiAnnotation old = oldAnnotations.get(q);
|
||||||
PsiAnnotation oldA1 = oldAnnotations.get(q1);
|
//Probably, it is better to have it at the bottom if it is new.
|
||||||
PsiAnnotation oldA2 = oldAnnotations.get(q2);
|
//For example, it preserves the current behavior for @Override
|
||||||
if (oldA1 != null && oldA2 != null) {
|
if (old == null) return Integer.MAX_VALUE;
|
||||||
return oldA1.getTextRange().getStartOffset() - oldA2.getTextRange().getStartOffset();
|
return old.getTextRange().getStartOffset();
|
||||||
}
|
});
|
||||||
return 0;
|
|
||||||
};
|
|
||||||
PsiModifierList newList2 = ModifierListUtil.createSortedModifierList(newList, comparator, false);
|
PsiModifierList newList2 = ModifierListUtil.createSortedModifierList(newList, comparator, false);
|
||||||
if (newList2 != null) {
|
if (newList2 != null) {
|
||||||
new CommentTracker().replace(newList, newList2);
|
new CommentTracker().replace(newList, newList2);
|
||||||
|
|||||||
@@ -1345,7 +1345,7 @@ usage.target.exception=Exception
|
|||||||
usage.target.package.in.directory={0} (in {1})
|
usage.target.package.in.directory={0} (in {1})
|
||||||
use.external.annotations=Use &external annotations
|
use.external.annotations=Use &external annotations
|
||||||
generate.type.use.before.type=Generate annotations allowed for TYPE_USE directly &before a type
|
generate.type.use.before.type=Generate annotations allowed for TYPE_USE directly &before a type
|
||||||
generate.type.use.before.type.description=Annotations with TYPE_USE as their target will be placed directly before a type. Otherwise, they will be placed before all modifiers
|
generate.type.use.before.type.description=Annotations with TYPE_USE as their target will be placed directly before a type. Otherwise, they will be placed before all modifiers.
|
||||||
wrapping.annotation.enums=Enum field annotations
|
wrapping.annotation.enums=Enum field annotations
|
||||||
wrapping.annotation.parameters=Annotation parameters
|
wrapping.annotation.parameters=Annotation parameters
|
||||||
wrapping.record.components=Record components
|
wrapping.record.components=Record components
|
||||||
|
|||||||
Reference in New Issue
Block a user