Replace $S with J2ME.newString.

This commit is contained in:
Marcus Cavanaugh 2014-12-23 14:17:16 -06:00
Родитель e8ed6b3a99
Коммит b8bbc48e87
10 изменённых файлов: 39 добавлений и 39 удалений

Просмотреть файл

@ -197,7 +197,7 @@ Native["com/nokia/mid/s40/codec/DataDecoder.getString.(I)Ljava/lang/String;"] =
if (str === undefined) {
throw $.newIOException("tag (" + tag + ") invalid");
}
return $S(str);
return J2ME.newString(str);
};
Native["com/nokia/mid/s40/codec/DataDecoder.getInteger.(I)J"] = function(tag) {
@ -221,7 +221,7 @@ Native["com/nokia/mid/s40/codec/DataDecoder.getName.()Ljava/lang/String;"] = fun
if (name === undefined) {
throw $.newIOException();
}
return $S(name);
return J2ME.newString(name);
};
Native["com/nokia/mid/s40/codec/DataDecoder.getType.()I"] = function() {

Просмотреть файл

@ -6,11 +6,11 @@
var RECORD_STORE_BASE = "/RecordStore";
Native["com/sun/midp/io/j2me/storage/File.initConfigRoot.(I)Ljava/lang/String;"] = function(storageId) {
return $S("assets/" + storageId + "/");
return J2ME.newString("assets/" + storageId + "/");
};
Native["com/sun/midp/midletsuite/MIDletSuiteStorage.getSecureFilenameBase.(I)Ljava/lang/String;"] = function(id) {
return $S("");
return J2ME.newString("");
};
Native["com/sun/midp/rms/RecordStoreUtil.exists.(Ljava/lang/String;Ljava/lang/String;I)Z"] =

Просмотреть файл

@ -1114,7 +1114,7 @@ var currentlyFocusedTextEditor;
};
Native["com/nokia/mid/ui/TextEditor.getContent.()Ljava/lang/String;"] = function() {
return $S(this.textEditor.getContent());
return J2ME.newString(this.textEditor.getContent());
};
Native["com/nokia/mid/ui/TextEditor.setContent.(Ljava/lang/String;)V"] = function(jStr) {

Просмотреть файл

@ -113,7 +113,7 @@ Native["com/sun/mmedia/DefaultConfiguration.nListContentTypesNext.(I)Ljava/lang/
return null;
}
var s = cached.shift();
return s ? $S(s) : null;
return s ? J2ME.newString(s) : null;
};
Native["com/sun/mmedia/DefaultConfiguration.nListContentTypesClose.(I)V"] = function(hdlr) {
@ -141,7 +141,7 @@ Native["com/sun/mmedia/DefaultConfiguration.nListProtocolsNext.(I)Ljava/lang/Str
return null;
}
var s = cached.shift();
return s ? $S(s) : null;
return s ? J2ME.newString(s) : null;
};
Native["com/sun/mmedia/DefaultConfiguration.nListProtocolsClose.(I)V"] = function(hdlr) {
@ -930,11 +930,11 @@ Native["com/sun/mmedia/PlayerImpl.nTerm.(I)I"] = function(handle) {
Native["com/sun/mmedia/PlayerImpl.nGetMediaFormat.(I)Ljava/lang/String;"] = function(handle) {
var player = Media.PlayerCache[handle];
player.mediaFormat = player.getMediaFormat();
return $S(player.mediaFormat);
return J2ME.newString(player.mediaFormat);
};
Native["com/sun/mmedia/DirectPlayer.nGetContentType.(I)Ljava/lang/String;"] = function(handle) {
return $S(Media.PlayerCache[handle].getContentType());
return J2ME.newString(Media.PlayerCache[handle].getContentType());
};
Native["com/sun/mmedia/PlayerImpl.nIsHandledByDevice.(I)Z"] = function(handle) {

Просмотреть файл

@ -706,7 +706,7 @@ Native["com/sun/midp/midletsuite/MIDletSuiteStorage.suiteExists.(I)Z"] = functio
};
Native["com/sun/midp/midletsuite/MIDletSuiteStorage.suiteIdToString.(I)Ljava/lang/String;"] = function(id) {
return $S(id.toString());
return J2ME.newString(id.toString());
};
Native["com/sun/midp/midletsuite/MIDletSuiteStorage.getMidletSuiteStorageId.(I)I"] = function(suiteId) {
@ -715,7 +715,7 @@ Native["com/sun/midp/midletsuite/MIDletSuiteStorage.getMidletSuiteStorageId.(I)I
};
Native["com/sun/midp/midletsuite/MIDletSuiteStorage.getMidletSuiteJarPath.(I)Ljava/lang/String;"] = function(id) {
return $S("");
return J2ME.newString("");
};
Native["com/sun/midp/midletsuite/MIDletSuiteImpl.lockMIDletSuite.(IZ)V"] = function(id, lock) {
@ -1008,7 +1008,7 @@ Native["com/sun/midp/l10n/LocalizedStringsBase.getContent.(I)Ljava/lang/String;"
throw $.newIllegalStateException();
}
return $S(value);
return J2ME.newString(value);
};
Native["javax/microedition/lcdui/Display.drawTrustedIcon0.(IZ)V"] = function(displayId, drawTrusted) {
@ -1091,7 +1091,7 @@ MIDP.keyNames = {
};
Native["javax/microedition/lcdui/KeyConverter.getKeyName.(I)Ljava/lang/String;"] = function(keyCode) {
return $S((keyCode in MIDP.keyNames) ? MIDP.keyNames[keyCode] : String.fromCharCode(keyCode));
return J2ME.newString((keyCode in MIDP.keyNames) ? MIDP.keyNames[keyCode] : String.fromCharCode(keyCode));
};
MIDP.gameKeys = {
@ -1305,7 +1305,7 @@ Native["com/sun/j2me/content/RegistryStore.init.()Z"] = function() {
Native["com/sun/j2me/content/RegistryStore.forSuite0.(I)Ljava/lang/String;"] = function(suiteID) {
console.warn("com/sun/j2me/content/RegistryStore.forSuite0.(I)Ljava/lang/String; not implemented");
return $S("");
return J2ME.newString("");
};
Native["com/sun/j2me/content/AppProxy.isInSvmMode.()Z"] = function() {

Просмотреть файл

@ -127,15 +127,15 @@ Native["com/sun/j2me/pim/PIMProxy.listClose0.(I)Z"] = function(listHandle, descr
Native["com/sun/j2me/pim/PIMProxy.getDefaultListName.(I)Ljava/lang/String;"] = function(listType) {
if (listType === PIM.CONTACT_LIST) {
return $S("ContactList");
return J2ME.newString("ContactList");
}
if (listType === PIM.EVENT_LIST) {
return $S("EventList");
return J2ME.newString("EventList");
}
if (listType === PIM.TODO_LIST) {
return $S("TodoList");
return J2ME.newString("TodoList");
}
return null;

Просмотреть файл

@ -303,7 +303,7 @@ Native["java/lang/Class.init9.()V"] = function() {
};
Native["java/lang/Class.getName.()Ljava/lang/String;"] = function() {
return $S(this.runtimeKlass.templateKlass.classInfo.className.replace(/\//g, "."));
return J2ME.newString(this.runtimeKlass.templateKlass.classInfo.className.replace(/\//g, "."));
};
Native["java/lang/Class.forName.(Ljava/lang/String;)Ljava/lang/Class;"] = function(name) {
@ -768,10 +768,10 @@ Native["com/sun/cldc/i18n/j2me/UTF_8_Reader.readNative.([CII)I"] = function(cbuf
Native["java/io/DataInputStream.bytesToUTF.([B)Ljava/lang/String;"] = function(bytearr) {
var array = new Uint8Array(bytearr.buffer);
try {
return $S(util.decodeUtf8Array(array));
return J2ME.newString(util.decodeUtf8Array(array));
} catch(e) {
try {
return $S(util.javaUTF8Decode(array));
return J2ME.newString(util.javaUTF8Decode(array));
} catch (e) {
throw $.newUTFDataFormatException();
}

Просмотреть файл

@ -53,11 +53,11 @@ function asyncImpl(returnKind, promise) {
}
Override["com/ibm/oti/connection/file/Connection.decode.(Ljava/lang/String;)Ljava/lang/String;"] = function(string) {
return $S(decodeURIComponent(string.str));
return J2ME.newString(decodeURIComponent(string.str));
};
Override["com/ibm/oti/connection/file/Connection.encode.(Ljava/lang/String;)Ljava/lang/String;"] = function(string) {
return $S(string.str.replace(/[^a-zA-Z0-9-_\.!~\*\\'()/:]/g, encodeURIComponent));
return J2ME.newString(string.str.replace(/[^a-zA-Z0-9-_\.!~\*\\'()/:]/g, encodeURIComponent));
};
Override["java/lang/Math.min.(II)I"] = function(a, b) {
@ -221,5 +221,5 @@ Override["com/sun/midp/security/Permissions.getId.(Ljava/lang/String;)I"] = func
// The Java code that uses this method doesn't actually use the return value, but
// passes it to Permissions.getId. So we can return anything.
Override["com/sun/midp/security/Permissions.getName.(I)Ljava/lang/String;"] = function(id) {
return $S("com.sun.midp");
return J2ME.newString("com.sun.midp");
};

Просмотреть файл

@ -212,18 +212,18 @@ Override["java/lang/String.substring.(I)Ljava/lang/String;"] = function(beginInd
if (beginIndex < 0 || beginIndex > this.str.length) {
throw $.newIndexOutOfBoundsException();
}
return $S(this.str.substring(beginIndex));
return J2ME.newString(this.str.substring(beginIndex));
};
Override["java/lang/String.substring.(II)Ljava/lang/String;"] = function(beginIndex, endIndex) {
if (beginIndex < 0 || endIndex > this.str.length || beginIndex > endIndex) {
throw $.newIndexOutOfBoundsException();
}
return $S(this.str.substring(beginIndex, endIndex));
return J2ME.newString(this.str.substring(beginIndex, endIndex));
};
Override["java/lang/String.concat.(Ljava/lang/String;)Ljava/lang/String;"] = function(s) {
return $S(this.str + s.str);
return J2ME.newString(this.str + s.str);
};
// via MDN:
@ -233,17 +233,17 @@ function escapeRegExp(str) {
Override["java/lang/String.replace.(CC)Ljava/lang/String;"] = function(oldChar, newChar) {
// Using a RegExp here to replace all matches of oldChar, rather than just the first.
return $S(this.str.replace(
return J2ME.newString(this.str.replace(
new RegExp(escapeRegExp(String.fromCharCode(oldChar)), "g"),
String.fromCharCode(newChar)));
};
Override["java/lang/String.toLowerCase.()Ljava/lang/String;"] = function() {
return $S(this.str.toLowerCase());
return J2ME.newString(this.str.toLowerCase());
};
Override["java/lang/String.toUpperCase.()Ljava/lang/String;"] = function() {
return $S(this.str.toUpperCase());
return J2ME.newString(this.str.toUpperCase());
};
Override["java/lang/String.trim.()Ljava/lang/String;"] = function() {
@ -258,7 +258,7 @@ Override["java/lang/String.trim.()Ljava/lang/String;"] = function() {
end--;
}
return $S(this.str.substring(start, end));
return J2ME.newString(this.str.substring(start, end));
};
Override["java/lang/String.toString.()Ljava/lang/String;"] = function() {
@ -279,30 +279,30 @@ Override["java/lang/String.valueOf.([C)Ljava/lang/String;"] = function(chars) {
if (!chars) {
throw $.newNullPointerException();
}
return $S(util.fromJavaChars(chars));
return J2ME.newString(util.fromJavaChars(chars));
};
Override["java/lang/String.valueOf.([CII)Ljava/lang/String;"] = function(chars, offset, count) {
if (!chars) {
throw $.newNullPointerException();
}
return $S(util.fromJavaChars(chars, offset, count));
return J2ME.newString(util.fromJavaChars(chars, offset, count));
};
Override["java/lang/String.valueOf.(Z)Ljava/lang/String;"] = function(bool) {
return $S(bool ? "true" : "false");
return J2ME.newString(bool ? "true" : "false");
};
Override["java/lang/String.valueOf.(C)Ljava/lang/String;"] = function(ch) {
return $S(String.fromCharCode(ch));
return J2ME.newString(String.fromCharCode(ch));
};
Override["java/lang/String.valueOf.(I)Ljava/lang/String;"] = function(n) {
return $S(n.toString());
return J2ME.newString(n.toString());
};
Override["java/lang/String.valueOf.(J)Ljava/lang/String;"] = function(n) {
return $S(n.toString());
return J2ME.newString(n.toString());
};
@ -605,7 +605,7 @@ Override["java/lang/StringBuffer.reverse.()Ljava/lang/StringBuffer;"] = function
};
Override["java/lang/StringBuffer.toString.()Ljava/lang/String;"] = function() {
return $S(util.fromJavaChars(this.buf, 0, this.count));
return J2ME.newString(util.fromJavaChars(this.buf, 0, this.count));
};
Override["java/lang/StringBuffer.setShared.()V"] = function() {

Просмотреть файл

@ -5,11 +5,11 @@ var lastSMSNumber = null;
var lastSMSBody = null;
Native["javax/wireless/messaging/SendSMSTest.getNumber.()Ljava/lang/String;"] = function() {
return $S(lastSMSNumber);
return J2ME.newString(lastSMSNumber);
};
Native["javax/wireless/messaging/SendSMSTest.getBody.()Ljava/lang/String;"] = function() {
return $S(lastSMSBody);
return J2ME.newString(lastSMSBody);
};
function MozActivity(obj) {