[Kaffe] reflection bug found, test case included
Moses DeJong
dejong at cs.umn.edu
Sat Mar 20 12:43:15 PST 1999
Hello all.
I have run into an interesting reflection bug in Kaffe. I do not have time
to track this one down today so I am going to post the test case in case
someone wants to track it down. I was running on a solaris sparc
(BigEndian) system when I got these results.
import java.lang.reflect.*;
public class ShortTest {
final static short tval = 3344;
int _foo;
public ShortTest(short f)
{
_foo = f;
}
public int getFoo()
{
return _foo;
}
public static void test1() throws Exception {
ShortTest st = new ShortTest(tval);
int foo = st.getFoo();
System.out.println("test1 foo is " + foo);
}
public static void test2() throws Exception {
Class mtc = ShortTest.class;
Class[] sig = {Short.TYPE};
Constructor mtc_con = mtc.getConstructor(sig);
Object[] args = {new Short(tval)};
ShortTest st = (ShortTest) mtc_con.newInstance(args);
int foo = st.getFoo();
System.out.println("test2 foo is " + foo);
}
public static void main(String[] args) throws Exception {
test1();
test2();
}
}
// JDK
//
// % java ShortTest
// test1 foo is 3344
// test2 foo is 3344
// Kaffe
//
// % kaffe ShortTest
// test1 foo is 3344
// test2 foo is 219152384
thanks
Mo DeJong
dejong at cs.umn.edu
More information about the kaffe
mailing list