A hierarchical finite state machine for Java 8