[TIMOB-19943] Android: Support casting hyperloop proxies to different native types
GitHub Issue | n/a |
---|---|
Type | Story |
Priority | High |
Status | Closed |
Resolution | Done |
Resolution Date | 2016-08-04T03:20:01.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.4.0 |
Components | Android, Hyperloop |
Labels | n/a |
Reporter | Christopher Williams |
Assignee | Christopher Williams |
Created | 2015-11-12T16:48:15.000+0000 |
Updated | 2016-08-04T03:20:01.000+0000 |
Description
Previously we'd return/wrap any arguments and return types as the actual Java type we received, rather than the type declared by the method return/param type. this led to an issue where we'd receive types that weren't available in our hyperloop JS wrappers (either because they weren't in the type hierarchy we traversed - or more important, if they were "hidden"/native types). As an example, we'd get a DisplayListCanvas (a subclass of Canvas) in a subclass of View's onDraw method. That type isn't in the android.jar and we have no means of trying to get it's details without the android source code. the method declares the param type as simply Canvas.
As a hedge against this, when we wrap arguments or return types, we hold the object and it's specific subclass on the Java side, but report as and wrap with the declared type. As a result, that means we now need some way to be able to explicitly cast down to subclasses if we know the value is a more specific subclass (say on View.getLayoutParams).
https://github.com/appcelerator/hyperloop-android-module/pull/11