+ // In case the class is already resolved we can simply ask the runtime
+ // to give us the array version.
+ // If it is not resolved we prepend "[" to the classname to make the
+ // array usage verification more lazy. In other words: makes new Foo[300]
+ // pass the verifier if Foo.class is missing.
+ if (klass->is_resolved)
+ {
+ jclass k = klass->getclass (verifier);
+
+ return type (_Jv_GetArrayClass (k, k->getClassLoaderInternal()),
+ verifier);
+ }
+ else
+ {
+ int len = klass->data.name->len();
+
+ // If the classname is given in the Lp1/p2/cn; format we only need
+ // to add a leading '['. The same procedure has to be done for
+ // primitive arrays (ie. provided "[I", the result should be "[[I".
+ // If the classname is given as p1.p2.cn we have to embed it into
+ // "[L" and ';'.
+ if (klass->data.name->limit()[-1] == ';' ||
+ _Jv_isPrimitiveOrDerived(klass->data.name))
+ {
+ // Reserves space for leading '[' and trailing '\0' .
+ char arrayName[len + 2];
+
+ arrayName[0] = '[';
+ strcpy(&arrayName[1], klass->data.name->chars());
+
+#ifdef VERIFY_DEBUG
+ // This is only needed when we want to print the string to the
+ // screen while debugging.
+ arrayName[len + 1] = '\0';
+
+ debug_print("len: %d - old: '%s' - new: '%s'\n", len, klass->data.name->chars(), arrayName);
+#endif
+
+ return type (verifier->make_utf8_const( arrayName, len + 1 ),
+ verifier);
+ }
+ else
+ {
+ // Reserves space for leading "[L" and trailing ';' and '\0' .
+ char arrayName[len + 4];
+
+ arrayName[0] = '[';
+ arrayName[1] = 'L';
+ strcpy(&arrayName[2], klass->data.name->chars());
+ arrayName[len + 2] = ';';
+
+#ifdef VERIFY_DEBUG
+ // This is only needed when we want to print the string to the
+ // screen while debugging.
+ arrayName[len + 3] = '\0';
+
+ debug_print("len: %d - old: '%s' - new: '%s'\n", len, klass->data.name->chars(), arrayName);
+#endif
+
+ return type (verifier->make_utf8_const( arrayName, len + 3 ),
+ verifier);
+ }
+ }
+