PsiExpression (final PsiVariable local, final PsiElement refExpr, @NotNull PsiCodeBlock block, final boolean rethrow) { if (refExpr != null) { PsiElement def; if (refExpr instanceof PsiReferenceExpression && PsiUtil.isAccessedForWriting((PsiExpression)refExpr)) { def = refExpr; } else { final PsiElement[] defs = DefUseUtil.getDefs(block, local, refExpr, rethrow); if (defs.length == 1) { def = defs[0]; } else { return null; } } if (def instanceof PsiReferenceExpression && def.getParent() instanceof PsiAssignmentExpression assignmentExpression) { if (assignmentExpression.getOperationTokenType() != JavaTokenType.EQ) return null; final PsiExpression rExpr = assignmentExpression.getRExpression(); if (rExpr != null) return rExpr; } } return local.getInitializer(); }