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

1.2.4->1.2.5



I'm in the process of upgrading from 1.2.4 to 1.2.5 and things seem very broken..
After getting my code to compile, I get an exception indicating:


java.lang.RuntimeException: not declared: startRun
        at soot.SootMethod.getDeclaringClass(SootMethod.java:165)
        at soot.SootMethod.getSignature(SootMethod.java:637)

By the code:

        SootMethod startRunMethod = mainClass.getMethodByName("startRun");
        mainClass.removeMethod(startRunMethod);
        for (Iterator methods = mainClass.getMethods().iterator();
             methods.hasNext();) {
            SootMethod method = (SootMethod)methods.next();
            System.out.println("method = " + method.toString());
        }

The problem is apparently that the method was not correctly removed from the class.

Looks like Ondrej rewrote the way methods are indexed in 1.2.5.

In SootMethod:
    public void removeMethod(SootMethod m)
    {
        subSigToMethods.put(m.getNumberedSubSignature(),null);
        m.isDeclared = false;
    }

While in SmallNumberMap:
public boolean put( Numberable key, Object value ) {
int pos = findPosition( key );
if( array[pos] == key ) return false; <================ This would seem to prevent the remove from removing?
size++;
if( size*3 > array.length*2 ) doubleSize();
pos = findPosition( key );
array[pos] = key;
values[pos] = value;
return true;
}


Yet, I'm confused, it would seem like regression tests would easily catch such refactoring bugs?

Steve