[Soot-list] ConcurrentModificationException in an extremely simple code piece

Sai Zhang racezhang at gmail.com
Wed May 26 13:59:52 EDT 2010


Thanks Eric/Patrick.

Using BodyTransformer  seems to be a bad choice.  But using SceneTransformer
seems to need enable the "-w" option and requires a main method (if I did
not remember wrong). For my case, "change the current method signature" and
probably add some new method to the SootClass, do you have have any
suggestion  or best practice on using which transformers? ( I did not have
experience in Soot to do so)

thanks

-Sai

On Tue, May 25, 2010 at 11:11 PM, Eric Bodden <
bodden at st.informatik.tu-darmstadt.de> wrote:

> Patrick is right.
>
> setName actually removes the method from the container class and then
> adds it again:
>
>    public void setName(String name) {
>        boolean wasDeclared = isDeclared;
>        SootClass oldDeclaringClass = declaringClass;
>        if( wasDeclared ) oldDeclaringClass.removeMethod(this);
>        this.name = name;
>        subsignature =
>            Scene.v().getSubSigNumberer().findOrAdd(getSubSignature());
>        if( wasDeclared) oldDeclaringClass.addMethod(this);
>    }
>
> My guess is that this is to keep some name-based information
> consistent. This causes your exception. This can even happen with just
> a single thread.
>
> The solution is to instead use a SceneTransformer (in the "wjtp" pack)
> because that does not execute such implicit iteration code.
>
> Eric
>
> --
> Dr. Eric Bodden
> Software Technology Group, Technische Universität Darmstadt, Germany
> Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
> Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt
>
>
>
> On 26 May 2010 02:32, Patrick Lam <plam at cs.mcgill.ca> wrote:
> > On 05/25/10 20:08, Sai Zhang wrote:
> >> It seems that there is no other thread in modifying the SootMethod
> object.
> >> So, a bit confused!  Any hints are welcome!
> >
> > I haven't looked at this case in particular, but
> > ConcurrentModificationExceptions arise when you iterate on a list and
> > modify it during iteration, even if there's only one thread.
> >
> > pat
> > _______________________________________________
> > Soot-list mailing list
> > Soot-list at sable.mcgill.ca
> > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> >
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20100526/af6a2f20/attachment.html 


More information about the Soot-list mailing list