PsiModifierListOwner (final PsiAssignmentExpression assignment, final PsiField field) { PsiElement parentOwner = assignment; while (true) { parentOwner = PsiTreeUtil.getParentOfType(parentOwner, PsiModifierListOwner.class, true, PsiMember.class); if (parentOwner == null) return null; PsiElement parent = parentOwner.getParent(); if (parent == field.getContainingClass()) return (PsiModifierListOwner)parentOwner; } }