Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23213] Hyperloop: Android doesn't convert char/char[]/Character

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-04-27T16:18:35.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.4.0
ComponentsHyperloop
Labelsandroid, hyperloop
ReporterHans Knöchel
AssigneeChristopher Williams
Created2016-04-14T14:53:48.000+0000
Updated2016-08-03T00:05:46.000+0000

Description

We have no conversion of char/char[]/Character in our Kroll/V8 bridge - and we don't handle this special in our hyperloop code - so I assume right now it'll try to wrap in a hyperloop proxy and fail miserably. From discussion on https://github.com/appcelerator/hyperloop.next/pull/16 Ideally I think we should: - accept a JS String for any argument/field that accepts Character/char/char[] - if the string is for a single char/Character and has more than one character, we should take the first char of the string and spit out a nasty warning in the log. - When a method/field returns a char/char[]/Character, convert it into a Java String and the bridge will convert that to a JS string for us.

Comments

  1. Wilson Luu 2016-08-03

    Closing ticket as fixed. Verified Hyperloop with Android is able to convert char/char[]/Character. Use the following Alloy code:
       var
           String = require('java.lang.String'),
           Character = require('java.lang.Character');
       
       var
           single = new String('d'),
           longString = new String('monkey lord'),
           arrayOfChars = new String(['b', 'o', 'b']);
       
       function doClick(e) {
           Ti.API.info('### ' + single.charAt(0));
           Ti.API.info('### ' + longString.toCharArray());
           Ti.API.info('### ' + arrayOfChars.toUpperCase());
           Ti.API.info('### ' + Character.valueOf('B'));
           Ti.API.info('### ' + Character.toUpperCase('z'));
           Ti.API.info('### ' + Character.toLowerCase('BOB')); // spits out error
       }
       
       $.index.open();
       
    Tested on: Appc CLI NPM: 4.2.7 Appc CLI Core: 5.4.0-37 Arrow: 1.8.2 SDK: 5.4.0.v20160801022303 Node: v4.4.7 OS: Mac OS X (10.11.6) Device: Genymotion Emulator (5.1.0)

JSON Source