Skip to content

Make canAccept consider events handled by parent states (#128)#153

Open
amenski wants to merge 1 commit into
hekailiang:masterfrom
amenski:fix/issue-128-canaccept-parent
Open

Make canAccept consider events handled by parent states (#128)#153
amenski wants to merge 1 commit into
hekailiang:masterfrom
amenski:fix/issue-128-canaccept-parent

Conversation

@amenski

@amenski amenski commented May 21, 2026

Copy link
Copy Markdown

Summary

While in a nested state, AbstractStateMachine.canAccept only checked the current state's own acceptable events, returning false for events handled by an ancestor state - even though internalFire delegates declined events up the parent chain.

This walks the parent chain in canAccept, applying the same region / parallel-state boundary that internalFire uses.

Fixes #128.

Test plan

  • Added Issue128 test - verified to fail on the original code and pass with the fix.
  • Full suite passes (155 tests, JDK 8).

While in a nested state, canAccept only checked the current state's own
acceptable events and returned false for events handled by an ancestor
state, even though internalFire delegates declined events up the parent
chain. Walk the parent chain in canAccept, applying the same region and
parallel-state boundary that internalFire uses.
@amenski amenski force-pushed the fix/issue-128-canaccept-parent branch from 87c7220 to 10f17b3 Compare May 21, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AbstractStateMachine.canAccept(E event) does not work for events acceptable from parent state

1 participant