void (@NotNull AnnotationHolder holder, @NotNull GrTypeDefinition typeDefinition, @NotNull PsiClass superClass, PsiMethod @NotNull[] constructors) { PsiMethod defConstructor = getDefaultConstructor(superClass); boolean needExplicitSuperCall = superClass.getConstructors().length != 0 && (defConstructor == null || !PsiUtil.isAccessible(typeDefinition, defConstructor)); if (!needExplicitSuperCall) return; final String qName = superClass.getQualifiedName(); if (!(superClass instanceof GrRecordDefinition) && typeDefinition.getConstructors().length == 0) { final TextRange range = GrHighlightUtil.getClassHeaderTextRange(typeDefinition); holder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle.message("there.is.no.default.constructor.available.in.class.0", qName)) .range(range) .withFix(QuickFixFactory.getInstance().createCreateConstructorMatchingSuperFix(typeDefinition)).create(); } for (PsiMethod method : constructors) { if (method instanceof GrMethod) { final GrOpenBlock block = ((GrMethod)method).getBlock(); if (block == null) continue; final GrStatement[] statements = block.getStatements(); if (statements.length > 0) { if (statements[0] instanceof GrConstructorInvocation) continue; } holder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle.message("there.is.no.default.constructor.available.in.class.0", qName)) .range(GrHighlightUtil.getMethodHeaderTextRange(method)).create(); } } List<PsiAnnotation> annotations = ContainerUtil.filter(typeDefinition.getAnnotations(), anno -> GrGeneratedConstructorUtils.getConstructorGeneratingAnnotations().contains(anno.getQualifiedName())); for (PsiAnnotation anno : annotations) { PsiNameValuePair preAttribute = AnnotationUtil.findDeclaredAttribute(anno, TupleConstructorAttributes.PRE); TextRange errorRange; if (preAttribute == null) { errorRange = GrHighlightUtil.getClassHeaderTextRange(typeDefinition); } else if (!GeneratedConstructorAnnotationChecker.isSuperCalledInPre(anno)) { errorRange = preAttribute.getTextRange(); } else { errorRange = null; } if (errorRange != null) { holder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle.message("there.is.no.default.constructor.available.in.class.0", qName)).range(errorRange).create(); } } }