isAllowedIntermediateCall) {
+ for (PsiMethodCallExpression chainCall = getCallForQualifier(call); chainCall != null;
+ chainCall = getCallForQualifier(chainCall)) {
+ String name = chainCall.getMethodExpression().getReferenceName();
+ if (name == null) return null;
+ if (isWantedCall.test(name)) return chainCall;
+ if (!isAllowedIntermediateCall.test(name) ||
+ !InheritanceUtil.isInheritor(chainCall.getType(), CommonClassNames.JAVA_UTIL_STREAM_BASE_STREAM)) {
+ return null;
+ }
+ }
+ return null;
+ }
}
diff --git a/resources-en/src/inspectionDescriptions/EndlessStream.html b/resources-en/src/inspectionDescriptions/EndlessStream.html
new file mode 100644
index 000000000000..18acf25f41e8
--- /dev/null
+++ b/resources-en/src/inspectionDescriptions/EndlessStream.html
@@ -0,0 +1,10 @@
+
+
+Non-short-circuit operation consumes the infinite stream. Operation may be completed only by throwing the exception.
+
+Example:
+
+ Stream.iterate(0, i -> i + 1).collect(Collectors.toList())
+
+
+
\ No newline at end of file