[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem in Class.java
From: |
John Leuner |
Subject: |
Problem in Class.java |
Date: |
Tue, 24 Apr 2001 23:53:38 +0000 |
User-agent: |
Mutt/1.3.15i |
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
--