+2001-10-25 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
+
+ * java/lang/VMClassLoader.java (getPrimitiveClass): Now native. Now
+ takes a jchar type-code argument, not a string.
+ * java/lang/natClassLoader.cc (VMClassLoader::getPrimitiveClass):
+ New method. Just call _Jv_FindClassFromSignature.
+ * java/lang/Boolean.java (TYPE): Initialize from
+ VMClassLoader.getPrimitiveClass using type-code.
+ * java/lang/Character.java (TYPE): Likewise.
+ * java/lang/Double.java (TYPE): Likewise.
+ * java/lang/Float.java (TYPE): Likewise.
+ * java/lang/Integer.java (TYPE): Likewise.
+ * java/lang/Long.java (TYPE): Likewise.
+ * java/lang/Short.java (TYPE): Likewise.
+ * java/lang/Void.java (TYPE): Likewise.
+
2001-10-25 Hans Boehm <Hans_Boehm@hp.com>
* include/boehm-gc.h: Call thread local allocation functions
* The primitive type <code>boolean</code> is represented by this
* <code>Class</code> object.
*/
- public static final Class TYPE = VMClassLoader.getPrimitiveClass("boolean");
+ public static final Class TYPE = VMClassLoader.getPrimitiveClass('Z');
/**
* The immutable value of this Boolean.
public static final int MIN_RADIX = 2;
public static final int MAX_RADIX = 36;
- // This initialization is seemingly circular, but it is accepted
- // by javac, and is handled specially by gcc.
- public static final Class TYPE = char.class;
+ public static final Class TYPE = VMClassLoader.getPrimitiveClass('C');
// Space.
public static final byte SPACE_SEPARATOR = 12;
* The primitive type <code>double</code> is represented by this
* <code>Class</code> object.
*/
- public static final Class TYPE = VMClassLoader.getPrimitiveClass ("double");
+ public static final Class TYPE = VMClassLoader.getPrimitiveClass('D');
/**
* The immutable value of this Double.
* The primitive type <code>float</code> is represented by this
* <code>Class</code> object.
*/
- public static final Class TYPE = VMClassLoader.getPrimitiveClass ("float");
+ public static final Class TYPE = VMClassLoader.getPrimitiveClass('F');
/**
* The immutable value of this Float.
* The primitive type <code>int</code> is represented by this
* <code>Class</code> object.
*/
- public static final Class TYPE = VMClassLoader.getPrimitiveClass ("int");
+ public static final Class TYPE = VMClassLoader.getPrimitiveClass ('I');
/**
* The immutable value of this Integer.
* The primitive type <code>long</code> is represented by this
* <code>Class</code> object.
*/
- public static final Class TYPE = VMClassLoader.getPrimitiveClass ("long");
+ public static final Class TYPE = VMClassLoader.getPrimitiveClass ('J');
/**
* The immutable value of this Long.
* The primitive type <code>short</code> is represented by this
* <code>Class</code> object.
*/
- public static final Class TYPE = VMClassLoader.getPrimitiveClass("short");
+ public static final Class TYPE = VMClassLoader.getPrimitiveClass('S');
/**
* The immutable value of this Short.
/**
* Helper for java.lang.Integer, Byte, etc. to get the TYPE class
- * at initialization time. If there are multiple classloaders, this
- * method may be called once per ClassLoader per type.
+ * at initialization time.
*
- * @param type name of the primitive type; i.e. "int", "byte", etc.
- * @return a "bogus" class representing the primitive type.
+ * @param type code for the primitive type.
*/
- static final Class getPrimitiveClass(String type)
- {
- if ("int".equals (type))
- return int.class;
- else if ("long".equals (type))
- return long.class;
- else if ("boolean".equals (type))
- return boolean.class;
- else if ("short".equals (type))
- return short.class;
- else if ("char".equals (type))
- return char.class;
- else if ("byte".equals (type))
- return byte.class;
- else if ("float".equals (type))
- return float.class;
- else if ("double".equals (type))
- return double.class;
- else if ("void".equals (type))
- return void.class;
- return null;
- }
+ static native Class getPrimitiveClass(char type);
}
* The return type <code>void</code> is represented by this
* <code>Class</code> object.
*/
- public static final Class TYPE = VMClassLoader.getPrimitiveClass("void");
+ public static final Class TYPE = VMClassLoader.getPrimitiveClass('V');
/**
* Don't allow Void objects to be made.
#include <java/lang/ClassCircularityError.h>
#include <java/lang/IncompatibleClassChangeError.h>
#include <java/lang/VirtualMachineError.h>
+#include <java/lang/VMClassLoader.h>
#include <java/lang/reflect/Modifier.h>
#include <java/lang/Runtime.h>
#include <java/lang/StringBuffer.h>
klass->notifyAll ();
}
+jclass
+java::lang::VMClassLoader::getPrimitiveClass (jchar type)
+{
+ char sig[2];
+ sig[0] = (char) type;
+ sig[1] = '\0';
+ return _Jv_FindClassFromSignature (sig, NULL);
+}
+
// This is the findClass() implementation for the System classloader. It is
// the only native method in VMClassLoader, so we define it here.
jclass