1.1 --- a/emul/src/main/java/java/lang/Class.java Tue Jan 22 11:14:00 2013 +0100
1.2 +++ b/emul/src/main/java/java/lang/Class.java Thu Jan 24 17:08:02 2013 +0100
1.3 @@ -278,6 +278,10 @@
1.4 * @since JDK1.1
1.5 */
1.6 public boolean isInstance(Object obj) {
1.7 + if (isArray()) {
1.8 + return isAssignableFrom(obj.getClass());
1.9 + }
1.10 +
1.11 String prop = "$instOf_" + getName().replace('.', '_');
1.12 return hasProperty(obj, prop);
1.13 }
1.14 @@ -312,7 +316,21 @@
1.15 * null.
1.16 * @since JDK1.1
1.17 */
1.18 - public native boolean isAssignableFrom(Class<?> cls);
1.19 + public boolean isAssignableFrom(Class<?> cls) {
1.20 + if (this == cls) {
1.21 + return true;
1.22 + }
1.23 +
1.24 + if (isArray()) {
1.25 + final Class<?> cmpType = cls.getComponentType();
1.26 + if (isPrimitive()) {
1.27 + return this == cmpType;
1.28 + }
1.29 + return cmpType != null && getComponentType().isAssignableFrom(cmpType);
1.30 + }
1.31 + String prop = "$instOf_" + getName().replace('.', '_');
1.32 + return hasProperty(cls, prop);
1.33 + }
1.34
1.35
1.36 /**