void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { final PsiField field; if (element instanceof PsiReferenceExpression referenceExpression) { final PsiElement target = referenceExpression.resolve(); if (!(target instanceof PsiField)) { return; } field = (PsiField)target; } else { final PsiElement parent = element.getParent(); if (!(parent instanceof PsiField)) { return; } field = (PsiField)parent; } field.normalizeDeclaration(); final PsiModifierList modifierList = field.getModifierList(); if (modifierList == null) { return; } modifierList.setModifierProperty(PsiModifier.VOLATILE, false); modifierList.setModifierProperty(PsiModifier.FINAL, true); }