+ return `new java.lang.Double(${this->value})`;
+ },
+ });
+
+ $cy_set(java.lang.Object.prototype, {
+ toCYON: function(key) {
+ return "#" + this.toString().toCYON();
+ },
+
+ // XXX: due to lack of interface prototypes :(
+ $cyg: function(key) {
+ return this.get(key);
+ },
+
+ // XXX: due to lack of interface prototypes :(
+ $cys: function(key, value) {
+ if ("set" in this)
+ this.set(key, value);
+ else
+ this.put(key, value);
+ },
+ });
+
+ $cy_set(java.lang.Throwable.prototype, {
+ toCYON: function() {
+ var message = this.getMessage();
+ if (message == null)
+ message = '';
+ else
+ message = message.toCYON();
+
+ let stack = this.getStackTrace();
+ if (stack.length == 0)
+ stack = '';
+ else {
+ stack = stack.join('\n ');
+ stack = ` /*\n ${stack} */`;
+ }
+
+ return `new ${this.constructor.class.getName()}(${message})${stack}`;
+ },
+ });
+});
+
+}
+
+if ("ObjectiveC" in Cycript) {
+ $cy_set(NSArray.prototype, {
+ $cyg: function(key) {
+ return objc_msgSend(this, "objectAtIndex:", key);
+ },
+
+ $cys: function(key, value) {
+ return objc_msgSend(this, "setObject:atIndex:", value, key);
+ },
+ });
+
+ $cy_set(NSDictionary.prototype, {
+ $cyg: function(key) {
+ return objc_msgSend(this, "objectForKey:", key);
+ },
+
+ $cys: function(key, value) {
+ return objc_msgSend(this, "setObject:forKey:", value, key);