Re: [PATCH] [JAVA] Double.parseDouble(null) throw NullPointerException

2011-08-12 Thread Tom Tromey
> "Jie" == Jie Liu writes: Jie> In my debug, there appears no check for 'this' at start of String.length(): Yeah, I looked for uses of flag_check_references and didn't see one when building a method's body. So I guess I mis-remembered this. In any case, the spot you found is just the tip o

Re: [PATCH] [JAVA] Double.parseDouble(null) throw NullPointerException

2011-08-12 Thread Jie Liu
> If you did, then I don't know, you'll have to debug it, sorry. > > I vaguely recollect that -fcheck-references adds a check for 'this' at > the start of final methods.  If I'm misremembering, then that is > probably the problem. In my debug, there appears no check for 'this' at start of String.l

Re: [PATCH] [JAVA] Double.parseDouble(null) throw NullPointerException

2011-08-12 Thread Bryce McKinlay
On Fri, Aug 12, 2011 at 8:27 AM, Jie Liu wrote: > The method length() is not a final method, as java/lang/String.java line 447: > >  public int length() >  { >    return count; >  } > > Is this the problem? As String is a final class, all its methods are implicitly final. Bryce

Re: [PATCH] [JAVA] Double.parseDouble(null) throw NullPointerException

2011-08-12 Thread Jie Liu
> Jie> But it does not work as we want, is there something wrong? > > Did you rebuild all of libgcj? Yes. :) > > If you did, then I don't know, you'll have to debug it, sorry. > > I vaguely recollect that -fcheck-references adds a check for 'this' at > the start of final methods.  If I'm misrememb

Re: [PATCH] [JAVA] Double.parseDouble(null) throw NullPointerException

2011-08-10 Thread Tom Tromey
> "Jie" == Jie Liu writes: Jie> + *-*-rtems*) Jie> + can_unwind_signal=no Jie> + CHECKREFSPEC=-fcheck-references Jie> + DIVIDESPEC=-fuse-divide-subroutine Jie> + ;; This part is OK with a ChangeLog entry. Jie> + Spurious newline addition. Jie> But it does not work as we want, is ther

Re: [PATCH] [JAVA] Double.parseDouble(null) throw NullPointerException

2011-08-10 Thread Jie Liu
2011/8/10 Tom Tromey : >> "Jie" == Jie Liu writes: > > Jie> RTEMS does not have virtual memory management, so there is no error > Jie> when access the 0 address on rtems. > Jie> So 'str->length()' donot throw NPE and just return an meaningless value. > > If you compile the Java parts of the li

Re: [PATCH] [JAVA] Double.parseDouble(null) throw NullPointerException

2011-08-09 Thread Tom Tromey
> "Jie" == Jie Liu writes: Jie> RTEMS does not have virtual memory management, so there is no error Jie> when access the 0 address on rtems. Jie> So 'str->length()' donot throw NPE and just return an meaningless value. If you compile the Java parts of the library with -fcheck-references, it

Re: [PATCH] [JAVA] Double.parseDouble(null) throw NullPointerException

2011-08-09 Thread Jie Liu
Hi Tom, RTEMS does not have virtual memory management, so there is no error when access the 0 address on rtems. So 'str->length()' donot throw NPE and just return an meaningless value. Ps: There is a test: http://code.google.com/p/rtemsgcj/source/browse/trunk/algorithm/20110810NPE/?r=127, npe.c i

Re: [PATCH] [JAVA] Double.parseDouble(null) throw NullPointerException

2011-08-08 Thread Tom Tromey
> "Jie" == Jie Liu writes: Jie> + if(str == NULL) Jie> + throw new NullPointerException(); Jie> + Jie>int length = str->length(); Why doesn't 'str->length()' throw the NPE? Tom

Re: [PATCH] [JAVA] Double.parseDouble(null) throw NullPointerException

2011-08-07 Thread Jie Liu
Hi, When I use gcj on an RTOS(RTEMS), Double.parseDouble(null) throw NumberFormatException, but it should throw NullPointerException. So I add the patch below: Index: natVMDouble.cc === --- natVMDouble.cc (revision 172224) +++ n