[Soot-list] ConcurrentModificationException in an extremely simple code piece
Eric Bodden
bodden at st.informatik.tu-darmstadt.de
Wed May 26 02:11:19 EDT 2010
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
>
More information about the Soot-list
mailing list