[AC-2199] [android] v8 optional float/double argument failure
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2013-04-01T22:14:24.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Titanium SDK & CLI |
| Labels | android, arguments, kroll, optional, v8 |
| Reporter | Martin Guillon |
| Assignee | Daniel Sefton |
| Created | 2012-11-22T14:26:26.000+0000 |
| Updated | 2016-03-08T07:41:11.000+0000 |
Description
I am trying to add default values support to Ti.App.Properties.
Something like this
@Kroll.method
public double getDouble(String key, @Kroll.argument(optional=true) double defaultValue)
{
return appProperties.getDouble(key, defaultValue);
}
If i try to compile with that code i get an error:
[exec] src/native/../../generated/ti.modules.titanium.app.properties.PropertiesModule.cpp:314:22: error: invalid suffix "d" on integer constant
[exec] make: *** [/Volumes/data/dev/titanium/titanium_mobile/android/runtime/v8/obj/local/armeabi/objs/kroll-v8/__/__/generated/ti.modules.titanium.app.properties.PropertiesModule.o] Error 1
[exec] make: *** Waiting for unfinished jobs....
I had another at this using another method
And it worked. I am actually wondering if what i was doing was correct :s@Kroll.method public double getDouble(String key, @Kroll.argument(optional=true) Object obj) { double defaultValue = 0D; if (obj != null) { defaultValue = TiConvert.toDouble(obj); } return appProperties.getDouble(key, defaultValue); }For assistance, please use the Q&A: http://developer.appcelerator.com/questions/newest
This bug is still present in 3.4.0GA. The cpp code generator adds invalid suffixes on float and double optional Kroll.arguments.