Skip to content

Commit bcd2ae9

Browse files
author
zhourenjian@gmail.com
committed
Adding "hashCode", "toString" functions to class objects
1 parent a614e55 commit bcd2ae9

File tree

1 file changed

+9
-1
lines changed
  • sources/net.sf.j2s.java.core/src/java/lang

1 file changed

+9
-1
lines changed

sources/net.sf.j2s.java.core/src/java/lang/Class.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ Clazz.instantialize = function (objThis, args) {
15501550
/* protected */
15511551
/*-# innerFunctionNames -> iFN #-*/
15521552
Clazz.innerFunctionNames = [
1553-
"equals", "getName", "getClassLoader", "getResourceAsStream" /*# {$no.javascript.support} >>x #*/, "defineMethod", "defineStaticMethod",
1553+
"equals", "hashCode", "toString", "getName", "getClassLoader", "getResourceAsStream" /*# {$no.javascript.support} >>x #*/, "defineMethod", "defineStaticMethod",
15541554
"makeConstructor" /*# x<< #*/
15551555
];
15561556

@@ -1566,6 +1566,14 @@ Clazz.innerFunctions = {
15661566
return this === aFun;
15671567
},
15681568

1569+
hashCode : function () {
1570+
return this.getName ().hashCode ();
1571+
},
1572+
1573+
toString : function () {
1574+
return "class " + this.getName ();
1575+
},
1576+
15691577
/*
15701578
* Similar to Class#getName
15711579
*/

0 commit comments

Comments
 (0)