Object () { /* States are mergeable if: - Ephemeral flag is the same - Stack depth is the same - All DfaControlTransferValues in the stack are the same (otherwise finally blocks may not complete successfully) - All sentinels in the stack are the same (otherwise we may screw up the unrolled loops) - Top-of-stack value is the same (otherwise we may prematurely merge true/false on TOS right before jump which is very undesired) */ return StreamEx.of(myStack).<Object>mapLastOrElse( val -> val instanceof DfaControlTransferValue || val == myFactory.getSentinel() ? val : null, Function.identity()) .append(isEphemeral()).toImmutableList(); }