Using CodeConverter.replaceArrayAccess leads to a ConcurrentModificationException for some classes. For example for java.util.concurrent.ArrayBlockingQueue.
I am using version 3.27.0-GA.
leads to the following error:
javassist.build.JavassistBuildException: javassist.CannotCompileException: by java.util.ConcurrentModificationException
at boundarydetection.agent.Agent.applyTransformations(Agent.java:214)
at boundaryDetection.RTInstrumentation.transformRT(RTInstrumentation.java:52)
at boundaryDetection.RTInstrumentation.main(RTInstrumentation.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282)
at java.lang.Thread.run(Thread.java:748)
Caused by: javassist.CannotCompileException: by java.util.ConcurrentModificationException
at javassist.convert.TransformAccessArrayField.initialize(TransformAccessArrayField.java:83)
at javassist.CodeConverter.doit(CodeConverter.java:552)
at javassist.CtClassType.instrument(CtClassType.java:1530)
at boundarydetection.agent.Agent.transformClass(Agent.java:165)
at boundarydetection.agent.Agent.applyTransformations(Agent.java:212)
... 8 more
Caused by: java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1445)
at java.util.HashMap$KeyIterator.next(HashMap.java:1469)
at javassist.bytecode.analysis.Type.findCommonInterfaces(Type.java:499)
at javassist.bytecode.analysis.Type.findCommonInterfaces(Type.java:475)
at javassist.bytecode.analysis.Type.mergeClasses(Type.java:452)
at javassist.bytecode.analysis.Type.merge(Type.java:305)
at javassist.bytecode.analysis.Frame.merge(Frame.java:216)
at javassist.bytecode.analysis.Analyzer.merge(Analyzer.java:283)
at javassist.bytecode.analysis.Analyzer.mergeExceptionHandlers(Analyzer.java:300)
at javassist.bytecode.analysis.Analyzer.analyzeNextEntry(Analyzer.java:208)
at javassist.bytecode.analysis.Analyzer.analyze(Analyzer.java:142)
at javassist.convert.TransformAccessArrayField.initFrames(TransformAccessArrayField.java:107)
at javassist.convert.TransformAccessArrayField.initialize(TransformAccessArrayField.java:70)
... 12 more
This is caused by the manipulation of a map while iterating over its key set. So using an invalidated iterator.
at javassist.bytecode.analysis.Type.findCommonInterfaces(Type.java:499)
and the same for the value set
at javassist.bytecode.analysis.Type.findCommonInterfaces(Type.java:506)
Using CodeConverter.replaceArrayAccess leads to a ConcurrentModificationException for some classes. For example for java.util.concurrent.ArrayBlockingQueue. I am using version 3.27.0-GA.
leads to the following error: javassist.build.JavassistBuildException: javassist.CannotCompileException: by java.util.ConcurrentModificationException at boundarydetection.agent.Agent.applyTransformations(Agent.java:214) at boundaryDetection.RTInstrumentation.transformRT(RTInstrumentation.java:52) at boundaryDetection.RTInstrumentation.main(RTInstrumentation.java:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282) at java.lang.Thread.run(Thread.java:748) Caused by: javassist.CannotCompileException: by java.util.ConcurrentModificationException at javassist.convert.TransformAccessArrayField.initialize(TransformAccessArrayField.java:83) at javassist.CodeConverter.doit(CodeConverter.java:552) at javassist.CtClassType.instrument(CtClassType.java:1530) at boundarydetection.agent.Agent.transformClass(Agent.java:165) at boundarydetection.agent.Agent.applyTransformations(Agent.java:212) ... 8 more Caused by: java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextNode(HashMap.java:1445) at java.util.HashMap$KeyIterator.next(HashMap.java:1469) at javassist.bytecode.analysis.Type.findCommonInterfaces(Type.java:499) at javassist.bytecode.analysis.Type.findCommonInterfaces(Type.java:475) at javassist.bytecode.analysis.Type.mergeClasses(Type.java:452) at javassist.bytecode.analysis.Type.merge(Type.java:305) at javassist.bytecode.analysis.Frame.merge(Frame.java:216) at javassist.bytecode.analysis.Analyzer.merge(Analyzer.java:283) at javassist.bytecode.analysis.Analyzer.mergeExceptionHandlers(Analyzer.java:300) at javassist.bytecode.analysis.Analyzer.analyzeNextEntry(Analyzer.java:208) at javassist.bytecode.analysis.Analyzer.analyze(Analyzer.java:142) at javassist.convert.TransformAccessArrayField.initFrames(TransformAccessArrayField.java:107) at javassist.convert.TransformAccessArrayField.initialize(TransformAccessArrayField.java:70) ... 12 more
This is caused by the manipulation of a map while iterating over its key set. So using an invalidated iterator. at javassist.bytecode.analysis.Type.findCommonInterfaces(Type.java:499) and the same for the value set at javassist.bytecode.analysis.Type.findCommonInterfaces(Type.java:506)