Conversation
… Event object based on name
QuintinWillison
left a comment
There was a problem hiding this comment.
Thanks, this is a great start. However, as discussed in our call earlier today, this only presents one side of the story... I think we need to see:
- Addition of functionality that does directly the opposite of your
constructEventByNamestatic method - probably an instance method onEvent, perhaps simply something likegetEventName() - Some unit tests for this class hierarchy proving:
- that
Eventinstances can be represented as string and then rehydrated from the same - that attempts to rehydrate unsupported event types (those with non-nullary constructor) throw the right exception
- that attempts to rehydrate unknown event types throw the right exception
- that
We need to get rid of any code that uses runtime reflection. This has to be checked by the compiler.
|
@QuintinWillison could you please elaborate on |
|
Hi @martin-morek - so, the use of That method is dynamic at runtime. If the class name is different, because of obfuscation or something else outside of control as SDK developers, then that can mess things up - in particular from build to build of a application. Each class mast vend its own serialisation name from a static string. These cannot be dynamically sourced like this. |
…ctivation-state-machine
… soften impact of runtime failures.
forNamemethod in push activation state machine implementation and replaced by switch constructing Event object based on name