harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geir Magnusson Jr <g...@pobox.com>
Subject Re: [jchevm] native method API for _jc_new_intern_string -- do you plan to add to _jc_ilib_entry table?
Date Wed, 15 Feb 2006 05:07:47 GMT
could it throw an Error rather than while(true)?  Much easier to debug... :)

Weldon Washburn wrote:
> On 2/14/06, Tim Ellison <t.p.ellison@gmail.com> 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
> 
> 

Mime
View raw message