[kaffe] KJC's problem

Guilhem Lavaux guilhem.lavaux@free.fr
Fri Jul 11 13:08:01 2003


Hi all,

I am trying to fix the problem with KJC. For the moment, I am learning how =
it=20
works (and it is much work for me as I am not really aware with the problem=
s=20
of compilation) but I already understand one thing. If you try to put a=20
synchronized clause after a try {} catch you will always face the problem=20
which arise in ShutdownHookTest. To test it I wrote a really gory program:

import java.lang.*;


public class Test {
        static public void main(String args[]) {
                Object a =3D new Object();
                Object b =3D null;

                try {
                        b.wait(10);
                } catch (Exception e) {
                }

                synchronized (a) {
                        System.out.println("b=3D"+b);
                        try {
                                a.wait(20);
                        } catch (Exception e2) {
                        }
                }
        }
}

If you try to compile it with KJC and run it, you will get:
b=3Djava.lang.NullPointerException
Obviously this is not what b is. If you try this other program:

import java.lang.*;


public class Test {
        static void testSync(Object a, Object b) {
                synchronized (a) {
                        System.out.println("b=3D"+b);
                        try {
                                a.wait(20);
                        } catch (Exception e2) {
                        }
                }
        }
        static public void main(String args[]) {
                Object a =3D new Object();
                Object b =3D null;

                try {
                        b.wait(10);
                } catch (Exception e) {
                }

                testSync(a, b);
        }
}

You will get:
b=3Dnull

This is obviously a problem with the variable allocator... I will try to=20
produce a fix as soon as I can.


Regards,

Guilhem.