switchBody.addStmt(new JCaseStatement(info,
program.getLiteralInt(permutationId)));
}
// return new FooImpl();
JReturnStatement ret = new JReturnStatement(info, instantiation);
switchBody.addStmt(ret);
}
assert switchBody.getStatements().size() > 0 : "No case statement emitted "
+ "for supposedly soft-rebind type " + requestType.getName();
// switch (CollapsedPropertyHolder.getPermutationId()) { ... }
JSwitchStatement sw = new JSwitchStatement(info, new JMethodCall(info,
null, permutationIdMethod), switchBody);
// return new FallbackImpl(); at the very end.
assert mostUsedExpression != null : "No most-used expression";
JReturnStatement fallbackReturn = new JReturnStatement(info,
mostUsedExpression);
JMethodBody body = (JMethodBody) toReturn.getBody();
body.getBlock().addStmt(sw);
body.getBlock().addStmt(fallbackReturn);