emul/src/main/java/java/lang/Class.java
branchreflection
changeset 228 c40f70283620
parent 225 25e350c6385f
child 229 fb4c53e0097f
     1.1 --- a/emul/src/main/java/java/lang/Class.java	Sat Dec 01 08:52:30 2012 +0100
     1.2 +++ b/emul/src/main/java/java/lang/Class.java	Sat Dec 01 12:15:12 2012 +0100
     1.3 @@ -274,7 +274,9 @@
     1.4       *          {@code false} otherwise.
     1.5       * @since   JDK1.1
     1.6       */
     1.7 -    public native boolean isArray();
     1.8 +    public boolean isArray() {
     1.9 +        return false;
    1.10 +    }
    1.11  
    1.12  
    1.13      /**
    1.14 @@ -497,25 +499,25 @@
    1.15       * @since 1.5
    1.16       */
    1.17      public String getCanonicalName() {
    1.18 -        throw new UnsupportedOperationException();
    1.19 -//        if (isArray()) {
    1.20 -//            String canonicalName = getComponentType().getCanonicalName();
    1.21 -//            if (canonicalName != null)
    1.22 -//                return canonicalName + "[]";
    1.23 -//            else
    1.24 -//                return null;
    1.25 -//        }
    1.26 +        if (isArray()) {
    1.27 +            String canonicalName = getComponentType().getCanonicalName();
    1.28 +            if (canonicalName != null)
    1.29 +                return canonicalName + "[]";
    1.30 +            else
    1.31 +                return null;
    1.32 +        }
    1.33  //        if (isLocalOrAnonymousClass())
    1.34  //            return null;
    1.35  //        Class<?> enclosingClass = getEnclosingClass();
    1.36 -//        if (enclosingClass == null) { // top level class
    1.37 -//            return getName();
    1.38 -//        } else {
    1.39 -//            String enclosingName = enclosingClass.getCanonicalName();
    1.40 -//            if (enclosingName == null)
    1.41 -//                return null;
    1.42 -//            return enclosingName + "." + getSimpleName();
    1.43 -//        }
    1.44 +        Class<?> enclosingClass = null;
    1.45 +        if (enclosingClass == null) { // top level class
    1.46 +            return getName();
    1.47 +        } else {
    1.48 +            String enclosingName = enclosingClass.getCanonicalName();
    1.49 +            if (enclosingName == null)
    1.50 +                return null;
    1.51 +            return enclosingName + "." + getSimpleName();
    1.52 +        }
    1.53      }
    1.54  
    1.55      /**
    1.56 @@ -676,7 +678,9 @@
    1.57       * @see     java.lang.reflect.Array
    1.58       * @since JDK1.1
    1.59       */
    1.60 -    public native Class<?> getComponentType();
    1.61 +    public Class<?> getComponentType() {
    1.62 +        return null;
    1.63 +    }
    1.64  
    1.65      /**
    1.66       * Returns true if and only if this class was declared as an enum in the