Use boolean.valueOf() to simplify mixing of boxed and unboxed booleans
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Sun, 17 Apr 2016 13:13:39 +0200
changeset 19222d4597793958
parent 1921 aed8434561fc
child 1923 4185cdeeee7e
Use boolean.valueOf() to simplify mixing of boxed and unboxed booleans
rt/emul/mini/src/main/java/java/lang/Boolean.java
     1.1 --- a/rt/emul/mini/src/main/java/java/lang/Boolean.java	Sun Apr 17 07:40:34 2016 +0200
     1.2 +++ b/rt/emul/mini/src/main/java/java/lang/Boolean.java	Sun Apr 17 13:13:39 2016 +0200
     1.3 @@ -213,12 +213,9 @@
     1.4       * @return  {@code true} if the Boolean objects represent the
     1.5       *          same value; {@code false} otherwise.
     1.6       */
     1.7 -    public boolean equals(Object obj) {
     1.8 -        if (obj instanceof Boolean) {
     1.9 -            return value == ((Boolean)obj).booleanValue();
    1.10 -        }
    1.11 -        return false;
    1.12 -    }
    1.13 +    @JavaScriptBody(args = { "obj" }, body = "return obj && this.valueOf() === obj.valueOf();")
    1.14 +    @Override
    1.15 +    public native boolean equals(Object obj);
    1.16  
    1.17      /**
    1.18       * Returns {@code true} if and only if the system property