@@ -97,6 +97,17 @@ public class Stream {
97
97
98
98
private static final String PLUGIN_ID = FrameworkUtil .getBundle (Stream .class ).getSymbolicName ();
99
99
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
+
100
111
private Set <TransformationAction > actions ;
101
112
102
113
private final MethodInvocation creation ;
@@ -326,7 +337,7 @@ protected void convertToParallel(CompilationUnitRewrite rewrite) {
326
337
327
338
boolean done = false ;
328
339
329
- while (expression != null && !done ) {
340
+ while (expression != null && !done )
330
341
if (expression .getNodeType () == ASTNode .METHOD_INVOCATION ) {
331
342
MethodInvocation inv = (MethodInvocation ) expression ;
332
343
AST ast = creation .getAST ();
@@ -364,18 +375,6 @@ protected void convertToParallel(CompilationUnitRewrite rewrite) {
364
375
expression = inv .getExpression ();
365
376
} else
366
377
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 ());
379
378
}
380
379
381
380
protected void convertToSequential (CompilationUnitRewrite rewrite ) {
0 commit comments