@Nullable
  private static String getClassNameForJvm(@NotNull final PsiClass typeDefinition) {
    String suffix = typeDefinition instanceof GrTypeDefinition && ((GrTypeDefinition)typeDefinition).isTrait() ? "$Trait$Helper" : "";
    final PsiClass psiClass = typeDefinition.getContainingClass();
    if (psiClass != null) {
      String parent = getClassNameForJvm(psiClass);
      return parent == null ? null : parent + "$" + typeDefinition.getName() + suffix;
    }

    PsiFile file = typeDefinition.getContainingFile();
    if (file instanceof GroovyFile && ((GroovyFile)file).isScript()) {
      for (ScriptPositionManagerHelper helper : ScriptPositionManagerHelper.EP_NAME.getExtensions()) {
        String s = helper.isAppropriateScriptFile((GroovyFile)file) ? helper.customizeClassName(typeDefinition) : null;
        if (s != null) {
          return s;
        }
      }
    }

    String qname = typeDefinition.getQualifiedName();
    return qname == null ? null : qname + suffix;
  }
@Nullable
  private static String getClassNameForJvm(@NotNull final PsiClass typeDefinition)