almondtools / testrecorder

Create Test Fixtures from Runnable Java Code
http://testrecorder.amygdalum.net/
GNU Lesser General Public License v3.0
51 stars 5 forks source link

Handle ASM dependency #83

Closed almondtools closed 5 years ago

almondtools commented 6 years ago

The testrecorder agent uses asm 6 for code instrumentation. Using testrecorder along with other projects using asm can lead to class loading problems if the incorrect version is loaded.

Yet if the project where testrecorder is used is really legacy code, we cannot assume that the dependencies are managed properly (just updating the version of asm would possibly not work). This means that a main scenario for using testrecorder will not be supported.

Furthermore: Testrecorder uses Bytebuddy for attaching to the jvm. Bytebuddy brings its own implementation of asm - in a separate package, so it will not cause class loader problems. If a call to BytebuddyAgent.install instruments code with the internal asm, there is another risk that on asm version can instrument the bytecode and another cannot - so it is not sufficient to fix the version of asm in the project but maybe also the version of bytebuddy.

Possible solutions could be:

almondtools commented 5 years ago

A example how to solve problems with conflicting dependency versions is describe in Creating Testrecorder Custom Agents. An example is available at testrecorder-custom-agent.