Another two cases where it is safer to check for name of superclass, rather than equality. rt/emul/compact test randomly failed.
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Mon, 09 Jun 2014 18:21:37 +0200
changeset 1621dd848ea32287
parent 1620 15c6f1aabe13
child 1623 d9cdfd8ef694
Another two cases where it is safer to check for name of superclass, rather than equality. rt/emul/compact test randomly failed.
rt/emul/mini/src/main/java/java/lang/Class.java
rt/emul/mini/src/main/java/java/lang/Enum.java
     1.1 --- a/rt/emul/mini/src/main/java/java/lang/Class.java	Mon Jun 09 15:57:50 2014 +0200
     1.2 +++ b/rt/emul/mini/src/main/java/java/lang/Class.java	Mon Jun 09 18:21:37 2014 +0200
     1.3 @@ -1627,7 +1627,7 @@
     1.4          // the ENUM bit set; classes for specialized enum constants
     1.5          // don't do the former.
     1.6          return (this.getModifiers() & ENUM) != 0 &&
     1.7 -        this.getSuperclass() == java.lang.Enum.class;
     1.8 +        this.getSuperclass().getName().equals("java.lang.Enum");
     1.9      }
    1.10  
    1.11      /**
     2.1 --- a/rt/emul/mini/src/main/java/java/lang/Enum.java	Mon Jun 09 15:57:50 2014 +0200
     2.2 +++ b/rt/emul/mini/src/main/java/java/lang/Enum.java	Mon Jun 09 18:21:37 2014 +0200
     2.3 @@ -194,7 +194,7 @@
     2.4      public final Class<E> getDeclaringClass() {
     2.5          Class clazz = getClass();
     2.6          Class zuper = clazz.getSuperclass();
     2.7 -        return (zuper == Enum.class) ? clazz : zuper;
     2.8 +        return zuper.getName().equals("java.lang.Enum") ? clazz : zuper;
     2.9      }
    2.10  
    2.11      /**