[cp-patches] FYI: Fix bug in static Byte constructor

Andrew Haley aph at redhat.com
Mon Apr 21 10:43:52 UTC 2008


Andrew Hughes wrote:
> This fixes a bug introduced by Ian's patch which
> causes the Byte static initializer to get stuck
> in an infinite loop.
> 
> ChangeLog:
> 
> 2008-04-21  Andrew John Hughes  <gnu_andrew at member.fsf.org>
> 
> 	* java/lang/Byte.java:
> 	(static): Use a short as the loop counter, not
> 	a byte as this can't exceed MAX_VALUE.

Why use a short and not an int?

    for (int i=MIN_VALUE; i <= MAX_VALUE; i++)

would be more idiomatic and faster on many targets.

Andrew.





More information about the Classpath-patches mailing list