Skip to content

Commit

Permalink
Permit copy for TestExecutor AsyncContextMap (apple#1675)
Browse files Browse the repository at this point in the history
Motivation:
The `TestExecutor` was recently enhanced to install an invalid
`AsyncContextMap` when executing `Runnable` tasks to check for tasks
which did not properly save/restore the appropriate async context. The
invalid map should allow itself to be copied, producing an empty map,
for usages which want to initiate a new subscribe operation.
Modifications:
`copy()` returns a new empty map rather than generating an exception.
Result:
Now possible to subscribe() within a `Runnable` without providing an
`AsyncContextMap`.
  • Loading branch information
bondolo committed Aug 27, 2021
1 parent c103797 commit 21922ca
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ public Key<?> forEach(final BiPredicate<Key<?>, Object> consumer) {

@Override
public AsyncContextMap copy() {
throw invalidAccess();
return this;
}
}
}

0 comments on commit 21922ca

Please sign in to comment.