There can be multiple VMs in one browser and the primitive types may be shared. Using string comparition to compare primitive classes. closure
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Tue, 27 May 2014 16:36:07 +0200
branchclosure
changeset 1607ace1ff1087e7
parent 1606 4e05b6eabbc5
child 1608 5186733b7e07
There can be multiple VMs in one browser and the primitive types may be shared. Using string comparition to compare primitive classes.
rt/emul/mini/src/main/java/java/lang/Class.java
     1.1 --- a/rt/emul/mini/src/main/java/java/lang/Class.java	Tue May 27 15:22:04 2014 +0200
     1.2 +++ b/rt/emul/mini/src/main/java/java/lang/Class.java	Tue May 27 16:36:07 2014 +0200
     1.3 @@ -1747,6 +1747,14 @@
     1.4          "return this['desiredAssertionStatus'] ? this['desiredAssertionStatus'] : false;"
     1.5      )
     1.6      public native boolean desiredAssertionStatus();
     1.7 +
     1.8 +    public boolean equals(Object obj) {
     1.9 +        if (isPrimitive() && obj instanceof Class) {
    1.10 +            Class c = ((Class)obj);
    1.11 +            return c.isPrimitive() && getName().equals(c.getName());
    1.12 +        }
    1.13 +        return super.equals(obj);
    1.14 +    }
    1.15      
    1.16      static void registerNatives() {
    1.17          boolean assertsOn = false;