boolean (@NotNull PsiField field) { if (!super.isAvailable(field)) return false; PsiClass containingClass = field.getContainingClass(); assert containingClass != null; PsiMethod[] constructors = containingClass.getConstructors(); if (constructors.length > 0 && ContainerUtil.all(constructors, c -> c instanceof SyntheticElement)) return false; if (field.hasModifierProperty(PsiModifier.FINAL)) { PsiClassInitializer[] initializers = containingClass.getInitializers(); PsiElement[] elements = Arrays.stream(containingClass.getFields()) .map(f -> f.getInitializer()) .filter(Objects::nonNull) .toArray(PsiElement[]::new); return ReferencesSearch.search(field, new LocalSearchScope(ArrayUtil.mergeArrays(elements, initializers))).findFirst() == null; } return true; }