void (@NotNull GrTypeDefinition typeDefinition) { final PsiElement parent = typeDefinition.getParent(); if (!(typeDefinition.isAnonymous() || parent instanceof GrTypeDefinitionBody || parent instanceof GroovyFile || typeDefinition instanceof GrTypeParameter)) { final TextRange range = GrHighlightUtil.getClassHeaderTextRange(typeDefinition); myHolder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle.message("class.definition.is.not.expected.here")).range(range) .withFix(new GrMoveClassToCorrectPlaceFix(typeDefinition)).create(); } checkTypeDefinition(myHolder, typeDefinition); checkImplementedMethodsOfClass(myHolder, typeDefinition); checkConstructors(myHolder, typeDefinition); checkAnnotationCollector(myHolder, typeDefinition); checkSameNameMethodsWithDifferentAccessModifiers(myHolder, typeDefinition.getCodeMethods()); checkInheritorOfSelfTypes(myHolder, typeDefinition); }