-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removed forName method #689
Removed forName method #689
Conversation
… Event object based on name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
constructEventByName
static method - probably an instance method onEvent
, perhaps simply something likegetEventName()
- Some unit tests for this class hierarchy proving:
- that
Event
instances 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.
android/src/main/java/io/ably/lib/push/ActivationStateMachine.java
Outdated
Show resolved
Hide resolved
@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.
forName
method in push activation state machine implementation and replaced by switch constructing Event object based on name