fix compilation

This commit is contained in:
Maxim.Medvedev
2011-10-26 17:27:53 +04:00
parent 5d880ffee2
commit 8cf40f2762
4 changed files with 10 additions and 4 deletions
@@ -125,5 +125,6 @@ public interface JVMElementFactory {
@NotNull
PsiAnnotation createAnnotationFromText(@NotNull @NonNls String annotationText, @Nullable PsiElement context) throws IncorrectOperationException;
PsiElement createExpressionFromText(String text, PsiElement ctx) throws IncorrectOperationException;
@NotNull
PsiElement createExpressionFromText(@NotNull @NonNls String text, @Nullable PsiElement context) throws IncorrectOperationException;
}
@@ -453,4 +453,7 @@ public interface PsiElementFactory extends PsiJavaParserFacade, JVMElementFactor
*/
@NotNull
PsiCatchSection createCatchSection(@NotNull PsiType exceptionType, @NotNull String exceptionName, @Nullable PsiElement context) throws IncorrectOperationException;
@NotNull
PsiExpression createExpressionFromText(@NotNull String text, PsiElement context) throws IncorrectOperationException;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -106,7 +106,8 @@ public abstract class GroovyPsiElementFactory implements JVMElementFactory {
return createExpressionFromText(exprText, null);
}
public abstract GrExpression createExpressionFromText(String exprText, @Nullable PsiElement context);
@NotNull
public abstract GrExpression createExpressionFromText(@NotNull String exprText, @Nullable PsiElement context);
public abstract GrVariableDeclaration createFieldDeclaration(String[] modifiers, String identifier, @Nullable GrExpression initializer, @Nullable PsiType type);
public abstract GrVariableDeclaration createFieldDeclarationFromText(String text);
@@ -141,7 +141,8 @@ public class GroovyPsiElementFactoryImpl extends GroovyPsiElementFactory {
return createReferenceExpressionFromText(text);
}
public GrExpression createExpressionFromText(String text, PsiElement context) {
@NotNull
public GrExpression createExpressionFromText(@NotNull String text, PsiElement context) {
GroovyFileImpl file = (GroovyFileImpl)createGroovyFile(text, false, context);
GrTopStatement[] topStatements = file.getTopStatements();
if (topStatements.length == 0 || !(topStatements[0] instanceof GrExpression)) {