This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Patch: merge several Number classes with Classpath
- To: Tom Tromey <tromey at redhat dot com>
- Subject: Re: Patch: merge several Number classes with Classpath
- From: Mark Wielaard <mark at klomp dot org>
- Date: Mon, 23 Jul 2001 23:08:15 +0200
- Cc: Java Patch List <java-patches at gcc dot gnu dot org>
- References: <87zo9vmm2m.fsf@creche.redhat.com>
Hi,
On Mon, Jul 23, 2001 at 02:23:29PM -0600, Tom Tromey wrote:
> +
> + /**
> + * 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.
> + *
> + * @param type name of the primitive type; i.e. "int", "byte", etc.
> + * @return a "bogus" class representing the primitive type.
> + */
> + static final Class getPrimitiveClass(String type)
> + {
> + if ("int".equals (type))
> + return int.class;
> + else if ("long".equals (type))
> + return int.class;
> + else if ("boolean".equals (type))
> + return int.class;
> + else if ("short".equals (type))
> + return int.class;
> + else if ("char".equals (type))
> + return int.class;
> + else if ("byte".equals (type))
> + return int.class;
> + else if ("float".equals (type))
> + return int.class;
> + else if ("double".equals (type))
> + return int.class;
> + else if ("void".equals (type))
> + return int.class;
> + return null;
> + }
Note that you always return int.class.
Cheers,
Mark
--
Stuff to read:
<http://www.toad.com/gnu/whatswrong.html>
What's Wrong with Copy Protection, by John Gilmore