@@ -97,6 +97,17 @@ public class Stream {
9797
9898 private static final String PLUGIN_ID = FrameworkUtil .getBundle (Stream .class ).getSymbolicName ();
9999
100+ private static MethodInvocation findTerminalOperation (ASTNode astNode ) {
101+ if (astNode == null )
102+ return null ;
103+ else if (astNode .getNodeType () != ASTNode .METHOD_INVOCATION )
104+ throw new IllegalArgumentException (astNode + " must be a method invocation." );
105+ if (astNode .getParent ().getNodeType () != ASTNode .METHOD_INVOCATION )
106+ return (MethodInvocation ) astNode ;
107+ else
108+ return findTerminalOperation (astNode .getParent ());
109+ }
110+
100111 private Set <TransformationAction > actions ;
101112
102113 private final MethodInvocation creation ;
@@ -326,7 +337,7 @@ protected void convertToParallel(CompilationUnitRewrite rewrite) {
326337
327338 boolean done = false ;
328339
329- while (expression != null && !done ) {
340+ while (expression != null && !done )
330341 if (expression .getNodeType () == ASTNode .METHOD_INVOCATION ) {
331342 MethodInvocation inv = (MethodInvocation ) expression ;
332343 AST ast = creation .getAST ();
@@ -364,18 +375,6 @@ protected void convertToParallel(CompilationUnitRewrite rewrite) {
364375 expression = inv .getExpression ();
365376 } else
366377 done = true ;
367- }
368- }
369-
370- private static MethodInvocation findTerminalOperation (ASTNode astNode ) {
371- if (astNode == null )
372- return null ;
373- else if (astNode .getNodeType () != ASTNode .METHOD_INVOCATION )
374- throw new IllegalArgumentException (astNode + " must be a method invocation." );
375- if (astNode .getParent ().getNodeType () != ASTNode .METHOD_INVOCATION )
376- return (MethodInvocation ) astNode ;
377- else
378- return findTerminalOperation (astNode .getParent ());
379378 }
380379
381380 protected void convertToSequential (CompilationUnitRewrite rewrite ) {
0 commit comments