Friday 22 March 2019

Byteman 4.0.6 has been released

Byteman 4.0.6 is now available from the Byteman downloads page and from the Maven Central repository. It is the latest update release for use on JDK9+ runtimes. It is also recommended as the preferred release for use on JDK8- runtimes.

Byteman 4.0.6 updates the 4.0.5 release to ensure that it works  correctly on the latest JDK13 releases. Specifically, it ensures that Byteman is able to process class files with a JDK13 class file version (the previous release would run on JDK13 but could only consume classes whose bytecode file version was for JDK12 or lower.

Byteman 4.0.6 includes two exciting new features. The first provides support for a new location specifier AT/AFTER NEW. This can be used to inject a rule at locations in method code where a new instance or new array is created. Full details are provided in Rule Events section of the latest Byteman Programmer's Guide.


The second new feature has been contributed by Red Hat's Jonathan Halliday (many thanks, Jonathan). It extends the BMUnit package to support integration with JUnit5. The API change is relatively simple. With the original JUnit integration you needed to annotate your test classes with the JUnit4 @RunWith annotation, configuring it so it used Byteman class BMUnitRunner to run the tests. Integration with JUnit5 relies on use of annotation  @WithByteman. There is no longer any need to use a Byteman-specific Runner class.

Since JUnit5 relies on JDK8 classes you can only use this new feature on JDK8+. You will need to ensure that you include new jar byteman-bmunit5.jar as a dependency in order to be able to access the new annotation. Full details of how to configure BMUNit tests with JUnit5 have been added to the BMUnit tutorial.


Byteman 4.0.6 also includes a couple of small bug fixes. More details can be found in the Release Notes.