CauseItem (DfaValue value, PsiExpression ref) { if (!(value.getDfType() instanceof DfConstantType)) return null; if (ref instanceof PsiReferenceExpression) { PsiElement target = ((PsiReferenceExpression)ref).resolve(); if (target instanceof PsiVariable && ((PsiVariable)target).hasModifierProperty(PsiModifier.FINAL)) { PsiExpression initializer = PsiUtil.skipParenthesizedExprDown(((PsiVariable)target).getInitializer()); if (initializer != null) { return new CauseItem( JavaAnalysisBundle.message("dfa.find.cause.variable.is.initialized", JavaElementKind.fromElement(target).subject(), ((PsiVariable)target).getName(), initializer.getText()), initializer.getContainingFile() == ref.getContainingFile() ? initializer : ref); } } } return null; }