This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Tidy up class/type naming?
- From: Jim White <jim at pagesmiths dot com>
- To: kawa at sources dot redhat dot com
- Date: Tue, 29 Mar 2005 19:59:33 -0800
- Subject: Tidy up class/type naming?
Doing this back-to-back string substitution of '.' <-> '/' is kind of ugly.
How about changing ArrayType's use of getName to be the Java class name
("[elementClassName") instead of the Kawa's "display name"
("elementClassName[]")? That way the meaning of the name is consistent
between Kawa and Java and getReflectClass could just use getName. If
anyone really wants to "prettify" the name of array classes for display
they can do it there.
Jim
~/Projects/kawa/gnu/bytecode/ObjectType.java:
public String getInternalName()
{
return getName().replace('.', '/');
}
/** Get the java.lang.Class object for the representation type. */
public Class getReflectClass()
{
try
{
if (reflectClass == null)
{
/* #ifdef JAVA2 */
/* Specifies optional 'initialize' argument. */
reflectClass = Class.forName(getInternalName().replace('/', '.'),
false, getClass().getClassLoader());
/* #endif */
/* #ifndef JAVA2 */
// reflectClass = Class.forName(getInternalName().replace('/', '.'));
/* #endif */
}
flags |= EXISTING_CLASS;
}
catch (java.lang.ClassNotFoundException ex)
{
if ((flags & EXISTING_CLASS) != 0)
throw new RuntimeException("no such class: "+getName());
}
return reflectClass;
}
Jim