Description
The way the experimental MonitorAware
characteristic works is that it is tied to the MutableEvent
object, whose internals have tracking for the monitoring state. This allows the same event object to be passed into the listener for that event.
An idea that I have to solve needing to tie monitor-awareness to MutableEvent
is to instead prompt the event to return an instance of the event that would be used for monitoring listeners. For record events, this would just be themselves since they are immutable. But for inheritable events, it would be possible to return a subtype of the event where setters throw exceptions and getters for collections return unmodifiable views. While this would be more expensive than the system currently in place, it would be far more versatile, additionally removing the limitation of needing it to strictly be a subtype of MutableEvent
.