Skip to content
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

Explore the option to implement automatic conversion of primitive numeric types to their counterpart reference types #19

Closed
slavchev opened this issue Feb 13, 2015 · 1 comment
Labels

Comments

@slavchev
Copy link

byte -> java.lang.Byte
short -> java.lang.Short
int -> java.lang.Integer
long -> java.lang.Long
float -> java.lang.Float
double -> java.lang.Double

Module team found this issue in the following example:

function createReminder()
{
    var beginTime = java.util.Calendar.getInstance();
    beginTime.set(2012, 9, 14, 7, 30);
    var startMillis = beginTime.getTimeInMillis();
    var values = new android.content.ContentValues();
    // !!!
    values.put(android.provider.CalendarContract.Events.DTSTART, startMillis);
}

Workaround: for example long -> java.lang.Long.valueOf(...)

@Plamen5kov
Copy link
Contributor

We decided it's best to force the user to explicitly use the specific data type, because the runtime will sometimes be unable to figure out what conversion to make.
Example:
method put of android.content.ContentValues takes parameters float and double. In this case the user has to specify what overload he wants to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants