void (@NotNull PsiReferenceExpression expression) { PsiExpression qualifierExpression = expression.getQualifierExpression(); if (qualifierExpression != null && !(qualifierExpression instanceof PsiReferenceExpression)) { myIsConstant = false; return; } PsiElement refElement = expression.resolve(); if (!(refElement instanceof PsiVariable)) { myIsConstant = false; return; } PsiVariable variable = (PsiVariable)refElement; Boolean isConst = varIsConst.get(variable); if (isConst != null) { myIsConstant &= isConst.booleanValue(); return; } if (variable instanceof PsiEnumConstant) { myIsConstant = true; varIsConst.put(variable, Boolean.TRUE); return; } varIsConst.put(variable, Boolean.FALSE); if (!variable.hasModifierProperty(PsiModifier.FINAL)){ myIsConstant = false; return; } PsiExpression initializer = PsiFieldImpl.getDetachedInitializer(variable); if (initializer == null){ myIsConstant = false; return; } initializer.accept(this); varIsConst.put(variable, myIsConstant); }