classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about Boolean


From: Mark Wielaard
Subject: Re: Question about Boolean
Date: Thu, 19 Jul 2001 23:28:37 +0200
User-agent: Mutt/1.3.18i

Hi,

On Thu, Jul 19, 2001 at 12:06:46PM -0600, Tom Tromey wrote:
> Today I looked at merging Boolean and Integer with libgcj.
> 
> There's one patch I'd like to make but I don't know how valid it is.
> It is appended.
Would it not be simpler to add a VMClassLoader class to libgcj that
implements the getPrimitiveClass() method?

It seems that with gcj that method is very simple. Something like:

static Class getPrimitiveClass(Sting name) {
        if ("boolean".equals(name))
                return boolean.class;
        if ("char".equals(name))
                return char.class;
        if ("float".equals(name))
                return float.class;
        if ("double".equals(name))
                return double.class;
        if ("byte".equals(name))
                return byte.class;
        if ("short".equals(name))
                return short.class;
        if ("int".equals(name))
                return int.class;
        if ("long".equals(name))
                return long.class;
        if ("void".equals(name))
                return void.class;
        
        throw new ClassNotFoundError("No primitive class: " + name);
}

That way all VMs are treated equal.

Cheers,

Mark
-- 
Stuff to read:
    <http://www.toad.com/gnu/whatswrong.html>
  What's Wrong with Copy Protection, by John Gilmore



reply via email to

[Prev in Thread] Current Thread [Next in Thread]