mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java: split declaration & assignment: fix for very broken code (IDEA-254385)
forcePsiPostprocessAndRestoreElement may invalidate variable initializer GitOrigin-RevId: 31b99804e5603cff36494ecbf9f98c1716b13d22
This commit is contained in:
committed by
intellij-monorepo-bot
parent
84e10e37b0
commit
f8a53347cf
+11
@@ -0,0 +1,11 @@
|
||||
// "Split into declaration and assignment" "true"
|
||||
|
||||
class Foo {
|
||||
{
|
||||
int fieldIndexes;
|
||||
fieldIndexes = getFieldIndexes(Hellonew String[;]{""});
|
||||
}
|
||||
public int getFieldIndexes(String[] columns) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Split into declaration and assignment" "true"
|
||||
|
||||
class Foo {
|
||||
{
|
||||
<caret>int fieldIndexes = getFieldIndexes(Hellonew String[]{""});
|
||||
}
|
||||
public int getFieldIndexes(String[] columns) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -1662,7 +1662,10 @@ public final class ExpressionUtils {
|
||||
return (PsiAssignmentExpression)((PsiExpressionStatement)block.addAfter(statement, declaration)).getExpression();
|
||||
}
|
||||
finally {
|
||||
initializer.delete();
|
||||
initializer = var.getInitializer();
|
||||
if (initializer != null) {
|
||||
initializer.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user