could it throw an Error rather than while(true)?  Much easier to debug... :)

Weldon Washburn wrote:
On 2/14/06, Tim Ellison <[EMAIL PROTECTED]> wrote:
Weldon Washburn wrote:
Question -- does it make sense to include a stupid, simple
String.intern() in the kernel class to make it even easier and more
convenient for someone trying to graft Harmony Class Libraries to a
new JVM?
Sure, we can add it to the KERNEL module stubs so people can choose to
reuse it or replace it as they see fit.  Care to contribute yours?
OK. But I warn you its really stupid, really simple and... its never
even been compiled.  Below is the code:

private String [] internArray = new String[256];
    public String intern()
    {
        System.out.println("String.intern() is not fully implemented");

        for (int ii = 0; ii < internArray.length; ii++)
        {
            if (this.equals(internArray[ii]))
                return internArray[ii];
            if (internArray[ii] == null)
            {
                internArray[ii] = this;
                return this;
            }
        }
        while (true)
            System.out.println("String.intern() --- error, overflowed
intern storage");
    }

--
Weldon Washburn
Intel Middleware Products Division


Reply via email to