Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
ac83fab6
Commit
ac83fab6
authored
7 years ago
by
Roman Ivanov
Browse files
Options
Download
Email Patches
Plain Diff
SortContentAction: sort in bare array initializers :IDEA-183183
parent
206e46f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
java/java-impl/src/com/intellij/codeInsight/intention/impl/SortContentAction.java
+1
-3
...ntellij/codeInsight/intention/impl/SortContentAction.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/sortContent/afterBareStringArray.java
+9
-0
...deAnalyzer/quickFix/sortContent/afterBareStringArray.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/sortContent/beforeBareStringArray.java
+9
-0
...eAnalyzer/quickFix/sortContent/beforeBareStringArray.java
with
19 additions
and
3 deletions
+19
-3
java/java-impl/src/com/intellij/codeInsight/intention/impl/SortContentAction.java
+
1
-
3
View file @
ac83fab6
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/sortContent/afterBareStringArray.java
0 → 100644
+
9
-
0
View file @
ac83fab6
// "Sort content" "true"
import
java.util.*
;
public
class
Main
{
private
void
test
()
{
String
[]
ss
=
{
"K"
,
"aa"
,
"z"
,
"ä"
,
"я"
};
}
}
This diff is collapsed.
Click to expand it.
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/sortContent/beforeBareStringArray.java
0 → 100644
+
9
-
0
View file @
ac83fab6
// "Sort content" "true"
import
java.util.*
;
public
class
Main
{
private
void
test
()
{
String
[]
ss
=
{<
caret
>
"z"
,
"ä"
,
"K"
,
"aa"
,
"я"
};
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help