mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
process c-style arrays in setInitializer (IDEA-20538 )
This commit is contained in:
@@ -23,6 +23,7 @@ import com.intellij.psi.impl.GeneratedMarkerVisitor;
|
||||
import com.intellij.psi.impl.source.PsiTypeElementImpl;
|
||||
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.util.CharTable;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -154,7 +155,9 @@ public class JavaSharedImplUtil {
|
||||
if (eq == null) {
|
||||
final CharTable charTable = SharedImplUtil.findCharTableByTree(variableElement);
|
||||
eq = Factory.createSingleLeafElement(JavaTokenType.EQ, "=", 0, 1, charTable, variable.getManager());
|
||||
variableElement.addInternal((TreeElement)eq, eq, variable.getNameIdentifier().getNode(), Boolean.FALSE);
|
||||
PsiElement element = variable.getNameIdentifier();
|
||||
final ASTNode node = TreeUtil.skipElements(element.getNode().getTreeNext(), TokenSet.orSet(ElementType.WHITE_SPACE_BIT_SET, TokenSet.create(JavaTokenType.LBRACKET, JavaTokenType.RBRACKET)));
|
||||
variableElement.addInternal((TreeElement)eq, eq, node, Boolean.TRUE);
|
||||
eq = variableElement.findChildByRole(ChildRole.INITIALIZER_EQ);
|
||||
}
|
||||
variable.addAfter(initializer, eq.getPsi());
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Move assignment to field declaration" "true"
|
||||
public class Foo {
|
||||
|
||||
protected boolean isString[] = new boolean[123];
|
||||
|
||||
public Foo() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Move assignment to field declaration" "true"
|
||||
public class Foo {
|
||||
|
||||
protected boolean isString[] ;
|
||||
|
||||
public Foo() {
|
||||
isSt<caret>ring = new boolean[123];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user