mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 21:41:24 +07:00
split declaration: PIEAE (IDEA-190299)
This commit is contained in:
@@ -153,7 +153,6 @@ public class SplitDeclarationAction extends PsiElementBaseIntentionAction {
|
||||
PsiExpression rExpression = RefactoringUtil.convertInitializerToNormalExpression(initializer, var.getType());
|
||||
|
||||
commentTracker.replace(assignment.getRExpression(), rExpression);
|
||||
commentTracker.deleteAndRestoreComments(initializer);
|
||||
|
||||
PsiElement block = decl.getParent();
|
||||
if (block instanceof PsiForStatement) {
|
||||
@@ -185,7 +184,12 @@ public class SplitDeclarationAction extends PsiElementBaseIntentionAction {
|
||||
return (PsiAssignmentExpression)replaced.getExpression();
|
||||
}
|
||||
else {
|
||||
return (PsiAssignmentExpression)((PsiExpressionStatement)block.addAfter(statement, decl)).getExpression();
|
||||
try {
|
||||
return (PsiAssignmentExpression)((PsiExpressionStatement)block.addAfter(statement, decl)).getExpression();
|
||||
}
|
||||
finally {
|
||||
commentTracker.deleteAndRestoreComments(initializer);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Split into declaration and assignment" "true"
|
||||
|
||||
class Foo {
|
||||
void some() {
|
||||
Foo<T> f;
|
||||
f = new Foo<T>(){
|
||||
<T,V> void foo(T t, V v) {}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Split into declaration and assignment" "true"
|
||||
|
||||
class Foo {
|
||||
void some() {
|
||||
Foo<T> <caret>f = new Foo<T>(){
|
||||
<T,V> void foo(T t, V v) {}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user