PsiNewExpression (PsiLocalVariable variable, PsiStatement statement) { while (true) { statement = PsiTreeUtil.getPrevSiblingOfType(statement, PsiStatement.class); if (statement == null) return null; PsiExpression expression = ExpressionUtils.getAssignmentTo(statement, variable); if (isCollectionConstructor(expression)) { return (PsiNewExpression)expression; } if (VariableAccessUtils.variableIsUsed(variable, statement)) return null; } }