large Class.forName() patch
Archie Cobbs
archie at whistle.com
Thu Feb 3 15:51:14 PST 2000
Mo DeJong writes:
> It sounds like there is still some debate as to how the
> primitive classes should be searched for by name, so could
> we agree on this trimmed down patch that does not include
> the part that disables lookups for "int" and such?
Minor nit: it seems clearer to do this version of your first
itypes.c patch..
-Archie
___________________________________________________________________________
Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com
Index: itypes.c
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/itypes.c,v
retrieving revision 1.17
diff -u -r1.17 itypes.c
--- itypes.c 1999/11/29 23:44:10 1.17
+++ itypes.c 2000/02/03 23:49:21
@@ -131,23 +131,53 @@
Hjava_lang_Class*
classFromSig(const char** strp, Hjava_lang_ClassLoader* loader, errorInfo *einfo)
{
- Hjava_lang_Class* cl;
+ Hjava_lang_Class* cl = NULL;
Utf8Const* utf8;
const char* start;
const char* end;
- switch (*(*strp)++) {
- case 'V': return (voidClass);
- case 'I': return (intClass);
- case 'Z': return (booleanClass);
- case 'S': return (shortClass);
- case 'B': return (byteClass);
- case 'C': return (charClass);
- case 'F': return (floatClass);
- case 'D': return (doubleClass);
- case 'J': return (longClass);
- case '[': return (lookupArray(classFromSig(strp, loader, einfo),
- einfo));
+ /* Check for primitive types */
+ switch (*(*strp)) {
+ case 'V':
+ cl = voidClass;
+ break;
+ case 'I':
+ cl = intClass;
+ break;
+ case 'Z':
+ cl = booleanClass;
+ break;
+ case 'S':
+ cl = shortClass;
+ break;
+ case 'B':
+ cl = byteClass;
+ break;
+ case 'C':
+ cl = charClass;
+ break;
+ case 'F':
+ cl = floatClass;
+ break;
+ case 'D':
+ cl = doubleClass;
+ break;
+ case 'J':
+ cl = longClass;
+ break;
+ }
+ if (cl != NULL) { /* Any trailing junk is an error */
+ if (*++(*strp) != '\0') {
+ postException(einfo, JAVA_LANG(VerifyError));
+ return (NULL);
+ }
+ return (cl);
+ }
+
+ /* Non-primitive types */
+ switch (*(*strp)++) {
+ case '[':
+ return (lookupArray(classFromSig(strp, loader, einfo), einfo));
case 'L':
start = *strp;
for (end = start; *end != 0 && *end != ';'; end++)
More information about the kaffe
mailing list