Here are some comments:
- You should add your name to the list of authors on the ConvertToForLoopProposal.java
- You should not be using magic numbers in your code. For example else if (argExpr.length() >= 12 && argExpr.length() < 51) {// one variable what are 12 and 51 doing? If you ever have to use a magic number, it should be extracted into a constant with a meaningful name and well documented. But the fact that there are so many of these in your code leads me to believe that something is not quite right.
- I don't know why you have a special variable for println: String prtLine = "println";. You should not need to handle println explicitly.
- For code stylistic reasons, for loop variables should generally be called i and they should be declared in the for loop. I see that you use the same variable c throughout the method.
But, more fundamentally, I think there is a problem with your solution. As we discussed, the body of the the each closure should not be changing. All you need to do is convert the line(s) that contains the expression, the call to each, and the (potentially implicit) parameter. You simply need to rearrange the text, so something like this:
becomes:
for (it in foo.bar()) {
blah
}
Notice that the body of the each closure did not change. This allows you to keep the formatting identical inside of the closure.
Partial implementation. Still need to fill in the findReplacement method.