mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't let c-tyle variable normalization produce stub/text/PSI inconsistency
insert a space to avoid that
This commit is contained in:
@@ -22,6 +22,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.GeneratedMarkerVisitor;
|
||||
import com.intellij.psi.impl.PsiImplUtil;
|
||||
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.CharTable;
|
||||
@@ -153,7 +154,7 @@ public class JavaSharedImplUtil {
|
||||
element = firstBracket;
|
||||
while (true) {
|
||||
ASTNode next = element.getTreeNext();
|
||||
variableElement.removeChild(element);
|
||||
CodeEditUtil.removeChild(variableElement, element);
|
||||
if (element == lastBracket) break;
|
||||
element = next;
|
||||
}
|
||||
@@ -169,7 +170,7 @@ public class JavaSharedImplUtil {
|
||||
newType.acceptTree(new GeneratedMarkerVisitor());
|
||||
}
|
||||
newType.putUserData(CharTable.CHAR_TABLE_KEY, SharedImplUtil.findCharTableByTree(type));
|
||||
variableElement.replaceChild(type, newType);
|
||||
CodeEditUtil.replaceChild(variableElement, type, newType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class A{
|
||||
{
|
||||
AAA[][][] x ;
|
||||
AAA[][][] x;
|
||||
AAA[] y;
|
||||
AAA[] z;
|
||||
}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class Main {
|
||||
void main(boolean <var>b[]c d) { }
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class Main {
|
||||
void main(boolean[] b c d) { }
|
||||
}
|
||||
@@ -37,6 +37,7 @@ public class NormalizeDeclarationTest extends PsiTestCase{
|
||||
|
||||
public void test1() throws Exception { doTest(); }
|
||||
public void test2() throws Exception { doTest(); }
|
||||
public void testCStyleArrayParameterBeforeErrorId() throws Exception { doTest(); }
|
||||
|
||||
public void testSCR6549() throws Exception { doTest(); }
|
||||
public void testSCR9467() throws Exception { doTest(); }
|
||||
|
||||
Reference in New Issue
Block a user