@Nullable
  @Override
  public PsiClass findClass(@NotNull PsiElement place) {
    if (place.getLanguage() == GroovyLanguage.INSTANCE) {
      PsiClass containingClass = PsiTreeUtil.getParentOfType(place, PsiClass.class, false);
      while (containingClass instanceof PsiTypeParameter) {
        containingClass = PsiTreeUtil.getParentOfType(containingClass, PsiClass.class);
      }
      if (containingClass != null) return containingClass;

      PsiFile file = place.getContainingFile();
      if (file instanceof GroovyFile && ((GroovyFile)file).isScript()) {
        return ((GroovyFile)file).getScriptClass();
      }
    }
    return null;
  }
@Nullable
  @Override
  public PsiClass findClass(@NotNull PsiElement place)