Javaflow doesn't work with Java 7 since ASM 3.x doesn't support Java 7, mainly due to frame size computing issues.
So... this patch lifts everything to Java 7 and ASM 4.0.
- Removed BCEL support, including testcases and dependencies.
- Now depends on ASM 4.0 instead of 3.x.
- Debug output for tests (bytecode trace) is now output to target/test-instrumentation instead of the root directory.
- COMPUTE_FRAMES is used when writing instrumenting so that Java 7 stays happy
- Re-added some testcases I found on this JIRA to make sure I didn't reintroduce an old bug.
- All instrumented classes will now implement the empty Continuable interface. If instrumentation is attempted on a class that implements Continuable, an exception will be thrown. This is because multiple instrumentation by mistake = very bad.
- Suppressed a lot of warnings in the testcases.
- Changed target java version to Java 7 in the pom file (might be better to leave it at 1.5?)
- Javaflow version is now 2.0-SNAPSHOT due to breaking changes (removal of BCEL)
I've also made a maven plugin for instrumenting code (instead of the ANT task), but it is not included in this patch since I'm unsure of the commons project structure. It basically has to be in its own project and depend on this one.
On my TODO list:
- Add a check that ensures that the class version of the file being instrumented isn't changed by instrumentation. Happened a few times when code was compiled using Java 6 and JavaFlow was compiled with Java 7 and Java 7 was used for instrumentation.
- Add more testcases, check existing ones.
- Remove all warnings (by fixing them, not suppressing them).
- Add comments where possible.
- Detect and throw an exception if something not instrumented and is on the call stack when suspending/resuming. Not sure if possible, but definitely needed. Easy to miss something when not using class loader instrumentation (say, using OSGi you don't want to do that...)
- Make Javaflow an OSGi bundle.
It'd be nice if someone took a close look at the patch, since I'm fairly new when it comes to ASM.
Also, what version of Java should be targeted in the pom file?