boolean (@NotNull PsiElement element) { PsiElement list = element.getParent(); if (!(list instanceof GrModifierList)) return false; PsiElement parent = list.getParent(); // Do not mark public on fields as unnecessary // It may be put there explicitly to prevent getter/setter generation. if (parent instanceof GrVariableDeclaration) return false; // compact constructors are required to have a visibility modifier if (parent instanceof GrMethod && GrRecordUtils.isCompactConstructor((GrMethod)parent)) return false; return true; }