The method in vm/reference/java/lang/Class.java:

   public Class getComponentType() {
        if(isArray()) {
            try {
                return Class.forName(getName().substring(1));
            } catch(ClassNotFoundException e) {
                return null;
            }
        } else {
            return null;
        }
    }

is wrong.

The problem is that it is valid to call 

Class.forName("[Ljava.lang.Object;")

but not valid to call

Class.forName("Ljava.lang.Object;")

(you have to do "java.lang.Object")

Also it is valid to call:

Class.forName("[I")

but not valid to call

Class.forName("I") (well it's valid, but means something totally different)

So this method either has to parse the class name, or it could call a native method 
and let the VM do it.

John Leuner

-- 

_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to