mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SortContentAction: sort in bare array initializers :IDEA-183183
This commit is contained in:
@@ -188,9 +188,7 @@ public class SortContentAction extends PsiElementBaseIntentionAction {
|
||||
if (initializerExpression == null) return null;
|
||||
PsiExpression[] initializers = initializerExpression.getInitializers();
|
||||
if (initializers.length < MIN_EXPRESSION_COUNT) return null;
|
||||
PsiNewExpression newExpr = tryCast(initializerExpression.getParent(), PsiNewExpression.class);
|
||||
if (newExpr == null) return null;
|
||||
PsiArrayType arrayType = tryCast(newExpr.getType(), PsiArrayType.class);
|
||||
PsiArrayType arrayType = tryCast(initializerExpression.getType(), PsiArrayType.class);
|
||||
if (arrayType == null) return null;
|
||||
PsiType componentType = arrayType.getComponentType();
|
||||
if (!isSortableExpressions(initializers, componentType)) return null;
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Sort content" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Main {
|
||||
private void test() {
|
||||
String[] ss = {"K", "aa", "z", "ä", "я"};
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Sort content" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Main {
|
||||
private void test() {
|
||||
String[] ss = {<caret>"z", "ä", "K", "aa", "я"};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user