|
5 | 5 |
|
6 | 6 | // NOTES by Bob Hanson |
7 | 7 |
|
| 8 | +// BH 11/16/2017 10:52:53 PM adds method name aliasing for generics; adds String.contains$CharSequence(cs) |
8 | 9 | // BH 10/14/2017 8:17:57 AM removing all node-based dependency class loading; fix String.initialize with four arguments (arr->byte) |
9 | 10 | // BH 10/13/2017 7:03:28 AM fix for String.initialize(bytes) applying bytes as arguments |
10 | 11 | // BH 10/12/2017 6:34:01 AM totally re-written class loading using load(); no dependency nodes |
@@ -127,7 +128,7 @@ Clazz.new = function(c, args, cl) { |
127 | 128 |
|
128 | 129 | var t0 = (_profileNew ? window.performance.now() : 0); |
129 | 130 |
|
130 | | - if (c.__CLASS_NAME__) |
| 131 | + if (c.__CLASS_NAME__ && c.c$) |
131 | 132 | c = c.c$; |
132 | 133 |
|
133 | 134 | // an inner class will attach arguments to the arguments returned |
@@ -291,26 +292,22 @@ var unwrapArray = function (arr) { |
291 | 292 | return arr; |
292 | 293 | }; |
293 | 294 |
|
294 | | -/** |
295 | | - * Prepare synthetic callback references b$[] for an anonymous inner class. |
296 | | - * |
297 | | - * This implementation takes advantage of the fact that the inheritance of the |
298 | | - * outer object is a property of itself. |
299 | | - * |
300 | | - * @param innerObj this object |
301 | | - * @param args args[0] will be the outer object; args [1...] |
302 | | - * must be shifted back to be actual calling arguments |
303 | | - * @author Bob Hanson |
304 | | - */ |
305 | 295 | Clazz.newMethod$ = function (clazzThis, funName, funBody, isStatic) { |
| 296 | + if (funName.constructor == Array) { |
| 297 | + // If funName is an array, we are setting aliases for generic calls. |
| 298 | + // For example: ['compareTo$S', 'compareTo$TK', 'compareTo$TA'] |
| 299 | + // where K and A are generic types that are from a class<K> or class<A> assignment. |
| 300 | + for (var i = funName.length; --i >= 0;) |
| 301 | + Clazz.newMethod$(clazzThis, funName[i], funBody, isStatic); |
| 302 | + return; |
| 303 | + } |
306 | 304 | Clazz.saemCount0++; |
307 | 305 | funBody.exName = funName; |
308 | 306 | funBody.exClazz = clazzThis; // make it traceable |
309 | 307 | var f; |
310 | 308 | if (isStatic || funName == "c$") |
311 | | - clazzThis[funName] = clazzThis.prototype[funName] = funBody; |
312 | | - else |
313 | | - clazzThis.prototype[funName] = funBody; |
| 309 | + clazzThis[funName] = funBody; |
| 310 | + clazzThis.prototype[funName] = funBody; // allow static calls as though they were not static |
314 | 311 | }; |
315 | 312 |
|
316 | 313 | var aas = "AAA"; |
@@ -3937,11 +3934,20 @@ return-1; |
3937 | 3934 | } |
3938 | 3935 | }; |
3939 | 3936 |
|
| 3937 | + |
3940 | 3938 | sp.contentEquals$StringBuffer=function(sb){ |
3941 | 3939 | return (this == sb.s); |
3942 | 3940 | }; |
3943 | 3941 |
|
| 3942 | +sp.contains$CharSequence=function(cs){ |
| 3943 | +if(cs==null) |
| 3944 | + throw new NullPointerException(); |
| 3945 | +return (this == cs || this.length > cs.length$() && this.indexOf(cs.toString()) > -1); |
| 3946 | +}; |
| 3947 | + |
3944 | 3948 | sp.contentEquals$CharSequence=function(cs){ |
| 3949 | +if(cs==null) |
| 3950 | + throw new NullPointerException(); |
3945 | 3951 | if(this == cs) |
3946 | 3952 | return true; |
3947 | 3953 | if(this.length!=cs.length$()) |
|
0 commit comments