makeIndexable()));
// int step = ...
final SyntheticName stepName;
if (this.step != null) {
JCExpression stepExpr = makeStepExpr();
stepName = naming.alias("step");
result.add(makeVar(FINAL, stepName,
makeIndexType(),
stepExpr));
result.add(
make().If(
make().Binary(JCTree.LE, stepName.makeIdent(), make().Literal(0)),
makeThrowAssertionException(
new AssertionExceptionMessageBuilder(null)
.appendViolatedCondition("step > 0")
.prependAssertionDoc("step size must be greater than zero")
.build()),
null));
} else {
stepName = null;
}
// int length = java.lang.reflect.Array.getLength(array);
JCExpression lengthExpr = makeLengthExpr();
if (lengthExpr != null) {
result.add(makeVar(FINAL, lengthName,
makeIndexType(),
lengthExpr));
}
// int i = 0;
JCStatement iVar = makeVar(indexName,
makeIndexType(),
makeIndexInit());
// i < length;
JCExpression iCond = makeCondition();
// i++
JCExpression iIncr = makeIncrement(stepName);
Tree.ControlClause prevControlClause = currentForClause;
currentForClause = stmt.getForClause();
List<JCStatement> transformedBlock = transformBlock(getBlock());
currentForClause = prevControlClause;
// FOO element = java.lang.reflect.Array.get(array, i);
JCExpression elementGet = makeIndexedAccess();
Tree.ForIterator forIterator = getForIterator();
if (forIterator instanceof Tree.ValueIterator) {
String varName = Naming.getVariableName(((Tree.ValueIterator)forIterator).getVariable());
JCStatement variable = makeVar(FINAL,