The Java 1.5.0 documentation of java.lang.ClassLoader.loadClass states that the given name argument must be a binary name, as defined in The Java Language Specification, Second Edition (JLS). The problem is that it is unclear what the binary name of an array type is (and, whether java.lang.ClassLoader.loadClass is suitable at all to obtain Class instances that represent array types). JLS (13.1) states that "The binary name of a top-level type is its canonical name [...]" but I do not find any mention in JLS whether an array type is a top-level type. (Also, if for example the array type java.lang.String[] were a top-level type, this would mean that its binary name where "java.lang.String[]" (JLS, 6.7), but calling java.lang.Class.loadClass with this argument gives a ClassNotFoundException.)
It appears that "[Ljava/lang/String;" worked in Java 1.4 and fails in Java 1.5, and that "[Ljava.lang.String;" works in both Java 1.4 and Java 1.5, so I use the latter in my code for now...
###@###.### 2005-04-04 11:42:40 GMT