mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 11:53:49 +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) -> {
|
||||
String q1 = a1.getQualifiedName();
|
||||
String q2 = a2.getQualifiedName();
|
||||
if (q1 == null || q2 == null) return 0;
|
||||
PsiAnnotation oldA1 = oldAnnotations.get(q1);
|
||||
PsiAnnotation oldA2 = oldAnnotations.get(q2);
|
||||
if (oldA1 != null && oldA2 != null) {
|
||||
return oldA1.getTextRange().getStartOffset() - oldA2.getTextRange().getStartOffset();
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
Comparator<PsiAnnotation> comparator = Comparator.comparingInt(a -> {
|
||||
String q = a.getQualifiedName();
|
||||
if (q == null) return -1;
|
||||
PsiAnnotation old = oldAnnotations.get(q);
|
||||
//Probably, it is better to have it at the bottom if it is new.
|
||||
//For example, it preserves the current behavior for @Override
|
||||
if (old == null) return Integer.MAX_VALUE;
|
||||
return old.getTextRange().getStartOffset();
|
||||
});
|
||||
PsiModifierList newList2 = ModifierListUtil.createSortedModifierList(newList, comparator, false);
|
||||
if (newList2 != null) {
|
||||
new CommentTracker().replace(newList, newList2);
|
||||
|
||||
@@ -1345,7 +1345,7 @@ usage.target.exception=Exception
|
||||
usage.target.package.in.directory={0} (in {1})
|
||||
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.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.parameters=Annotation parameters
|
||||
wrapping.record.components=Record components
|
||||
|
||||
Reference in New Issue
Block a user