IOE in Grovy this-references
authorMaxim Medvedev <maxim.medvedev@jetbrains.com>
Mon, 30 Nov 2009 11:33:10 +0000 (14:33 +0300)
committerMaxim Medvedev <maxim.medvedev@jetbrains.com>
Mon, 30 Nov 2009 11:33:10 +0000 (14:33 +0300)
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrThisReferenceExpressionImpl.java

index 8ca1c89aeaa721673ac602edf4c6bea033f5fa3d..ed667c8466828eb47ad016c44f7f14663dd04362 100644 (file)
@@ -8,6 +8,7 @@ import com.intellij.lang.ASTNode;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.source.PsiImmediateClassType;
 import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.util.IncorrectOperationException;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
@@ -50,8 +51,14 @@ public class GrThisReferenceExpressionImpl extends GrExpressionImpl implements G
       final PsiElement resolved = qualifier.resolve();
       if (resolved instanceof PsiClass) {
         return new PsiImmediateClassType((PsiClass)resolved, PsiSubstitutor.EMPTY);
-      } else {
-        return JavaPsiFacade.getElementFactory(getProject()).createTypeFromText(qualifier.getText(), this);
+      }
+      else {
+        try {
+          return JavaPsiFacade.getElementFactory(getProject()).createTypeFromText(qualifier.getText(), this);
+        }
+        catch (IncorrectOperationException e) {
+          return null;
+        }
       }
     }