private static void checkTypeDefinition(AnnotationHolder holder, @NotNull GrTypeDefinition typeDefinition) {
    if (typeDefinition.isAnonymous()) {
      PsiClass superClass = ((PsiAnonymousClass)typeDefinition).getBaseClassType().resolve();
      if (superClass instanceof GrTypeDefinition && !GroovyConfigUtils.getInstance().isVersionAtLeast(typeDefinition, GroovyConfigUtils.GROOVY2_5_2) && ((GrTypeDefinition)superClass).isTrait()) {
        holder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle.message("anonymous.classes.cannot.be.created.from.traits")).range(typeDefinition.getNameIdentifierGroovy()).create();
      }
    }
    if (typeDefinition.isAnnotationType() && typeDefinition.getContainingClass() != null) {
      holder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle.message("annotation.type.cannot.be.inner")).range(typeDefinition.getNameIdentifierGroovy()).create();
    }

    if (!typeDefinition.hasModifierProperty(PsiModifier.STATIC)
        && (typeDefinition.getContainingClass() != null || typeDefinition instanceof GrAnonymousClassDefinition)) {
      GrTypeDefinition owner = PsiTreeUtil.getParentOfType(typeDefinition, GrTypeDefinition.class);
      if (owner instanceof GrTraitTypeDefinition) {
        holder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle.message("non.static.classes.not.allowed")).range(typeDefinition.getNameIdentifierGroovy()).create();
      }
    }
    checkTypeDefinitionModifiers(holder, typeDefinition);

    checkDuplicateClass(typeDefinition, holder);

    checkCyclicInheritance(holder, typeDefinition);
  }
private static void checkTypeDefinition(AnnotationHolder holder, @NotNull GrTypeDefinition typeDefinition)