[Kaffe] endian problem also breaks the Byte class.
Moses DeJong
dejong at cs.umn.edu
Sun Feb 7 19:09:27 PST 1999
I have been doing some more testing on the big vs little endian problem
and it looks like Byte has the same problem as Boolean (no surprise there).
This example file works on little endian box but it fails on a big endian
machine.
later
mo dejong
dejong at cs.umn.edu
import java.lang.reflect.*;
public class ReflectedByteBug4 {
public static void main(String[] argv) throws Exception {
Method m1 = ReflectedByteBug4.class.getMethod("maxByteObjectMethod", null);
System.out.println("m1 is " + m1);
Method m2 = ReflectedByteBug4.class.getMethod("minByteObjectMethod", null);
System.out.println("m2 is " + m2);
Byte tb = (Byte) m1.invoke(null,null);
Byte fb = (Byte) m2.invoke(null,null);
if (tb.byteValue() != Byte.MAX_VALUE) {
throw new Exception("byteValue() != Byte.MAX_VALUE");
}
if (fb.byteValue() != Byte.MIN_VALUE) {
throw new Exception("byteValue() != Byte.MIN_VALUE");
}
System.out.println("OK");
}
public static byte maxByteObjectMethod() {
return Byte.MAX_VALUE;
}
public static byte minByteObjectMethod() {
return Byte.MIN_VALUE;
}
}
More information about the kaffe
mailing list