boolean (@NotNull PsiReferenceExpression ref) { if (mayHaveSideEffect(ref.getQualifierExpression())) { return true; } PsiElement resolved = ref.resolve(); if (resolved instanceof PsiLocalVariable || resolved instanceof PsiParameter || resolved instanceof PsiClass || resolved instanceof PsiPackage) { return false; } if (resolved instanceof PsiField field) { return !field.hasModifierProperty(PsiModifier.FINAL); } if (resolved instanceof PsiMethod method) { return methodMayHaveSideEffect(method); } return true; }