// This parses the action as a list of statements and replaces variables by equivalent getters // called on a "machine" variable private static List<Statement> actionAsStatements(String action) { if (action.isEmpty()) { return Collections.emptyList(); } try { final BlockStmt block = JavaParser.parseBlock('{' + action + '}'); // Replace fields by getters block.accept(VariableToGetter.INSTANCE, null); return block.getStmts(); } catch (ParseException exception) { throw new RuntimeException(exception); } }