Skip to content

Commit ff0cda6

Browse files
authored
Merge pull request #53 from abego/ReferencePipeline_toArray_Bug
Bug: 'The method flatten ... is not applicable for the arguments ...'
2 parents b6a1091 + 8ed1ef5 commit ff0cda6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sources/net.sf.j2s.java.core/src/java/util/stream/ReferencePipeline.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,11 @@ public final <A> A[] toArray(IntFunction<A[]> generator) {
435435
// super type of U an ArrayStoreException will be thrown.
436436
@SuppressWarnings("rawtypes")
437437
IntFunction rawGenerator = (IntFunction) generator;
438-
return (A[]) Nodes.flatten(evaluateToArrayNode(rawGenerator), rawGenerator)
439-
.asArray(rawGenerator);
438+
// using extra temporary variable 'node' with explicit type 'Node<A>' required as Eclipse 4.7.3a reports error
439+
// 'The method flatten(Node<T>, IntFunction<T[]>) in the type Nodes is not applicable for the arguments (Node, IntFunction)'
440+
// when directly using 'evaluateToArrayNode(rawGenerator)' in call to 'Nodes.flatten'.
441+
Node<A> node = evaluateToArrayNode(rawGenerator);
442+
return (A[]) Nodes.flatten(node, rawGenerator).asArray(rawGenerator);
440443
}
441444

442445
@Override

0 commit comments

Comments
 (0)