CallHandler<CallChainSimplification> () { return CallHandler.of(STREAM_SUPPORT, call -> { PsiExpression[] args = call.getArgumentList().getExpressions(); PsiExpression parallel = args[1]; if (!ExpressionUtils.isLiteral(parallel, Boolean.TRUE) && !ExpressionUtils.isLiteral(parallel, Boolean.FALSE)) return null; PsiMethodCallExpression spliterator = tryCast(skipParenthesizedExprDown(args[0]), PsiMethodCallExpression.class); if (!SPLITERATOR.test(spliterator)) return null; PsiExpression qualifier = skipParenthesizedExprDown(spliterator.getMethodExpression().getQualifierExpression()); if (qualifier == null || (qualifier instanceof PsiThisExpression)) return null; return new ReplaceStreamSupportWithCollectionStreamFix(qualifier, ExpressionUtils.isLiteral(parallel, Boolean.TRUE)); }); }