Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26553] Android: Java code has no means of distinguishing between undefined and null coming from JavaScript

GitHub Issuen/a
TypeBug
PriorityHigh
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterChristopher Williams
AssigneeJoshua Quick
Created2018-11-13T15:30:38.000+0000
Updated2018-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).

Comments

No comments

JSON Source