[TIMOB-26553] Android: Java code has no means of distinguishing between undefined and null coming from JavaScript
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Christopher Williams |
Assignee | Joshua Quick |
Created | 2018-11-13T15:30:38.000+0000 |
Updated | 2018-11-13T17:58:26.000+0000 |
Description
Our Android runtime has no means of passing along the difference between
null
and undefined
when passing arguments to Java. We do have a KrollRuntime.UNDEFINED
object that was intended to be used as the placeholder for undefined
in Java, but it's only really used on the C++ side to wipe out some properties for the APIModule.
Specifically, we do have code for translating that object into undefined
when converting from Java to JS, but when we receive null
or undefined
and try to convert to a Java Object in TypeConverter.cpp
we translate that into a C++ NULL
, which then becomes a Java null
.
Typically this hasn't mattered that much, but the distinction can be useful for determining if a method's optional arguments were explicitly passed a null
versus not being specified at all (or explicitly passed undefined
).
No comments