don't use simple names in psi element factory. They can overload real variables

This commit is contained in:
Maxim.Medvedev
2012-03-26 18:10:58 +04:00
parent e858333884
commit 27e2b725e7
@@ -260,7 +260,7 @@ public class GroovyPsiElementFactoryImpl extends GroovyPsiElementFactory {
}
public GrClosableBlock createClosureFromText(String closureText, PsiElement context) throws IncorrectOperationException {
GroovyFile psiFile = createGroovyFile("def foo = " + closureText, false, context);
GroovyFile psiFile = createGroovyFile("def __hdsjfghk_sdhjfshglk_foo = " + closureText, false, context);
final GrStatement st = psiFile.getStatements()[0];
LOG.assertTrue(st instanceof GrVariableDeclaration, closureText);
final GrExpression initializer = ((GrVariableDeclaration)st).getVariables()[0].getInitializerGroovy();
@@ -282,7 +282,7 @@ public class GroovyPsiElementFactoryImpl extends GroovyPsiElementFactory {
public GrParameter createParameter(String name, @Nullable String typeText, @Nullable String initializer, @Nullable GroovyPsiElement context)
throws IncorrectOperationException {
StringBuilder fileText = new StringBuilder();
fileText.append("def foo(");
fileText.append("def dsfsadfnbhfjks_weyripouh_huihnrecuio(");
if (typeText != null) {
fileText.append(typeText).append(" ");
} else {
@@ -433,7 +433,7 @@ public class GroovyPsiElementFactoryImpl extends GroovyPsiElementFactory {
@NotNull
@Override
public GrAnnotation createAnnotationFromText(@NotNull @NonNls String annotationText, @Nullable PsiElement context) throws IncorrectOperationException {
return createMethodFromText(annotationText + " void foo() {}", context).getModifierList().getAnnotations()[0];
return createMethodFromText(annotationText + " void ___shdjklf_pqweirupncp_foo() {}", context).getModifierList().getAnnotations()[0];
}
@Override