[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dava creates strange code with synchronized()



I just noticed Dava creates some strange code whenever there is a
synchronised block. It is not able to reconstitute the synchronised block,
although the code produced seems to be correct with one exception: it is now
referring to the class soot.dava.toolkits.based.DavaMonitor.

I might have a look later when I have time.

Regards,
Stephen

Example code is included below.

Original:

class Ex1Sync {
	int sharedInt;

	void testSync1() {

		sharedInt = 10;

		synchronized (this) {
			sharedInt = sharedInt + 1;
		}
	}
}


Dava Output:

import soot.dava.toolkits.base.DavaMonitor.*;

class Ex1Sync
{
    int sharedInt;

    Ex1Sync()
    {
        super();

        return;
    }

    void testSync1() throws Throwable
    {
        sharedInt = 10;
        DavaMonitor.v().enter(this);

        try
        {
            sharedInt = sharedInt + 1;
        }
        catch (Throwable $r2)
        {
            DavaMonitor.v().exit(this);
            throw $r2;
        }

        DavaMonitor.v().exit(this);
        return;
    }
}