safer type text generation in groovy stubs
authorpeter <peter.gromov@jetbrains.com>
Mon, 26 Apr 2010 15:02:18 +0000 (16:02 +0100)
committerpeter <peter.gromov@jetbrains.com>
Mon, 26 Apr 2010 15:02:34 +0000 (16:02 +0100)
plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/generator/GroovyToJavaGenerator.java

index f3cf1cf50ea07090153199bb64cc0e158ff638aa..a13aeb826140bd03b8a2ada3b0b1c7cfb598bbb4 100644 (file)
@@ -775,7 +775,7 @@ public class GroovyToJavaGenerator {
     return getTypeText(typeElement.getType(), typeElement, false);
   }
 
-  private static String getTypeText(PsiType type, @Nullable PsiElement context, boolean allowVarargs) {
+  private static String getTypeText(@Nullable PsiType type, @Nullable PsiElement context, boolean allowVarargs) {
     if (context != null && type instanceof PsiClassType) {
       final String accessible = findAccessibleSuperClass(context, ((PsiClassType)type).resolve());
       if (accessible != null) {
@@ -791,6 +791,10 @@ public class GroovyToJavaGenerator {
       return componentText + "[]";
     }
 
+    if (type == null) {
+      return CommonClassNames.JAVA_LANG_OBJECT;
+    }
+
     String canonicalText = type.getCanonicalText();
     return canonicalText != null ? canonicalText : type.getPresentableText();
   }