void (@NotNull AnnotationHolder holder, @NotNull GrMethod method) { final List<HierarchicalMethodSignature> signatures = method.getHierarchicalMethodSignature().getSuperSignatures(); for (HierarchicalMethodSignature signature : signatures) { final PsiMethod superMethod = signature.getMethod(); if (!GrTraitUtil.isTrait(superMethod.getContainingClass()) && superMethod.hasModifierProperty(PsiModifier.FINAL)) { final String current = GroovyPresentationUtil.getSignaturePresentation(method.getSignature(PsiSubstitutor.EMPTY)); final String superPresentation = GroovyPresentationUtil.getSignaturePresentation(signature); final String superQName = getQNameOfMember(superMethod); holder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle.message("method.0.cannot.override.method.1.in.2.overridden.method.is.final", current, superPresentation, superQName)).range(GrHighlightUtil.getMethodHeaderTextRange(method)).create(); return; } final String currentModifier = VisibilityUtil.getVisibilityModifier(method.getModifierList()); final String superModifier = VisibilityUtil.getVisibilityModifier(superMethod.getModifierList()); if (PsiModifier.PUBLIC.equals(superModifier) && (PsiModifier.PROTECTED.equals(currentModifier) || PsiModifier.PRIVATE .equals(currentModifier)) || PsiModifier.PROTECTED.equals(superModifier) && PsiModifier.PRIVATE.equals(currentModifier)) { final String currentPresentation = GroovyPresentationUtil.getSignaturePresentation(method.getSignature(PsiSubstitutor.EMPTY)); final String superPresentation = GroovyPresentationUtil.getSignaturePresentation(signature); final String superQName = getQNameOfMember(superMethod); //noinspection MagicConstant final PsiElement modifier = method.getModifierList().getModifier(currentModifier); holder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle.message("method.0.cannot.have.weaker.access.privileges.1.than.2.in.3.4", currentPresentation, currentModifier, superPresentation, superQName, superModifier)).range(modifier != null ? modifier : method.getNameIdentifierGroovy()).create(); } } }