weave all: ConcurrentModificationException
Issue #2
resolved
When a "weave all" is performed, a ConcurrentModificationException is thrown in the Preprocessor. It seems that this does not happen all the time, so it might not be easily reproducible. For example, when weaving StockExchange at the point of "Weaving ParallelExecution into StockExchange" the following stack trace is given:
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
at java.util.HashMap$KeyIterator.next(HashMap.java:828)
at ca.mcgill.sel.ram.weaver.structuralview.PreProcessor.createSkeletonClasses(PreProcessor.java:405)
at ca.mcgill.sel.ram.weaver.structuralview.StructuralViewWeaver.weave(StructuralViewWeaver.java:91)
at ca.mcgill.sel.ram.weaver.RAMWeaver.weaveSingle(RAMWeaver.java:201)
at ca.mcgill.sel.ram.weaver.RAMWeaver.weaveAllTopDown(RAMWeaver.java:112)
at ca.mcgill.sel.ram.ui.runner.WeaverRunner.run(WeaverRunner.java:86)
Comments (4)
-
reporter -
reporter It also happens in
weaveAllButtomUp
as the instantiations are removed once woven. If it is not removed, it happens inupdateInstantiationDeclaratives
:at ca.mcgill.sel.ram.weaver.structuralview.PostProcessor.updateInstantiationDeclaratives(PostProcessor.java:77) at ca.mcgill.sel.ram.weaver.structuralview.StructuralViewWeaver.weave(StructuralViewWeaver.java:99) at ca.mcgill.sel.ram.weaver.RAMWeaver.weaveSingle(RAMWeaver.java:194) at ca.mcgill.sel.ram.weaver.RAMWeaver.weaveAllBottomUp(RAMWeaver.java:170)
-
Just pushed a new branch with the fix for this issue looks like i dont get this issue anymore.
-
- changed status to resolved
commited fix for this exception switched to iterators
- Log in to comment
The reason is that in
createSkeletonClasses
there is an iteration overtoAdd
, and later, something is removed and added to this hashmap which causes the exception. Maybe it is enough to use an iterator?https://bitbucket.org/mcgillram/touchram/src/0e77adc47629ce220888886ce99dd59316282817/ca.mcgill.sel.ram.weaver/src/ca/mcgill/sel/ram/weaver/structuralview/PreProcessor.java?at=master#cl-439