Tuesday, 10 January 2017

Byteman 4.0.0-BETA2 has been released

Byteman 4.0.0-BETA2 is now available from the Byteman downloads page and from the Maven Central repository.



This is a preview release allowing Byteman to be used with the latest JDK9 release (Early Access release b151 for JDK 9) which includes the Java Platform Module System (JPMS aka Jigsaw). Byteman 4.0.0-BETA2 updates the previous BETA1 release to cope with minor changes in the JPMS implementation. It introduces no new functionality.

Thursday, 15 December 2016

Byteman 4.0.0-BETA1 has been released

Byteman 4.0.0-BETA1 is now available from the Byteman downloads page and from the Maven Central repository.


This is a preview release allowing Byteman to be used with the latest JDK9 release (Early Access release b148 for JDK 9) which includes the Java Platform Module System (JPMS aka Jigsaw). Byteman 4.0.0-BETA1 updates the previous BETA0 release to cope with minor changes in the JPMS implementation. It introduces no new functionality.

Wednesday, 19 October 2016

Byteman 4.0.0-BETA0 has been released

Byteman 4.0.0-BETA0 is now available from the Byteman downloads page and from the Maven Central repository.

This is a preview release allowing Byteman to be used with a JDK9 that includes the Java Platform Module System (JPMS aka Jigsaw). It implements basic support for Byteman to operate in a module-enabled JDK (e.g. Early Access release b138 for JDK 9 with Project Jigsaw or your own release built from the Jigsaw project jake tree).
This release implements one new capability. Byteman rules may now access members of classes which belong to a named module but are not exported by that module (or only have limited exports). For example, the following initialization for BIND variable name will now pass typecheck:

  RULE . . .
  . . .
  BIND
    th = Thread.getCurrentThread();
    name = th.name;
  . . .


This release will operate as normal on JDK6-8.
On JDK9 only one issue is expected: rule compilation will fail when a rule refers to public types that are not exported by their owning module. For example, the following initialization for BIND variable u will fail to compile

  RULE . . .
  . . .
  COMPILE
  BIND
    u = Unsafe.Unsafe();
  . . .

There is no problem invoking the constructor and, indeed, this code will work if the COMPILE option is switched to NOCOMPILE. However, when the rule is translated to bytecode the reference to variable u of type Unsafe leads to  a verify error,. Currently bytecode is generated in a class in the unnamed module and Unsafe, although it is a public class, is not exported to the unnamed module. This limitation will be addressed in a later release.

Monday, 19 September 2016

Byteman 4.0.0-ALPHA has been released

Byteman 4.0.0-ALPHA is now available from the Byteman downloads page and from the Maven Central repository.


This is an alpha release allowing Byteman to be used on JDK9. It does not provide full JDK9 support. It simply allows Byteman to cope with class files generated with a JDK9 version tag and avoids breakage when a jar contains a module-info.class.
 
This release will operate as normal on JDK6-8. On JDK9 only one issue is expected: members of classes which belong to a named module but are not exported by that module will be inaccessible from Byteman rules. The full 4.0.0 release will restore full access to all public and private members irrespective of module encapsulation.

Thursday, 19 May 2016

Byteman 3.0.6 has been released

Byteman 3.0.6 is now available from the Byteman downloads page and from the Maven Central repository.

This is a micro-release which includes no new features and no (complete) bug fixes. What it does include is a (heuristic) workaround for BYTEMAN-288 which is needed to allow Gray Brown's fabulous Hawkular BTM project to use rule compilation more effectively. Many thanks to Gary for his help in identifying the current workaround.

 n.b. a complete fix for this issue is intended for inclusion in Byteman 3.0.7.

Thursday, 21 April 2016

Byteman 3.0.5 has been released

Byteman 3.0.5 is now available from the Byteman downloads page

This is primarily a bug-fix release for Byteman 3.0.4 but it also contains a few new features
  • COMPILE/NOCOMPILE clauses can now be inserted into scripts at the top level or into individual rules to enable/inhibit compilation to bytecode
  • A new LinkMap builtin API has been added to the default Helper, allowing arbitrary data to be easily saved and retrieved from one rule execution to the next. Kudos to Red Hat's Richard Achmatowitz for implementing this extremely useful new API.
  • A new location specifier AT EXCEPTION EXIT has been provided allowing rules to be triggered by exceptions passing out of a method. After rule processing the original exception is  implicitly rethrown unless the rule explicitly THROWs a new synthetic exception or else swallows the exception and perform a synthetic RETURN. I'm very grateful to Red Hat's Gary Brown for pushing such an elegant implementation of this feature in my direction when I was convinced it was going to be my worst plumbing nightmare.
  • The DTest contrib package has been updated to allow instrumentation of a class by name as an alternative to providing the class instance. Many thanks to Red Hat's Ondrej Chaloupka for providing this update.
Full details of the first three features are provided in the latest Programmer's Guide prepared from Asciidoc sources. This latest version of the guide also includes details of the prototype module import API for use with JBoss Modules. Another grateful shout-out to Red Hat's Marco Rietveld for his help in converting over from LibreOffice.

Details of the DTest contrib API updates are provided in the README for the package. n.b. Ondrej is working on further extensions to the DTest API to support instrumentation of interfaces by name and support instrumenting down hierarchies. These should be available in the next Byteman release.

Tuesday, 24 November 2015

Byteman 3.0.3 release trials module imports using the JBoss Modules plugin

Byteman 3.0.3 is now available from the Byteman downloads page 

This release is a trial release for the new module import capability (contributed by Red Hat's very own James Livingstone). This new feature allows Byteman to be fully integrated into a modular JDK runtime. It includes generic support for module imports and a plugin which implements imports for JBoss Modules (plugins for  OSGi and Jigsaw will follow).

Byteman can now be configured to employ a module system-specific plugin to resolve  IMPORT statements embedded in individual rules or at the top level in a rule script. IMPORT statements allow classes deployed in the module named by the IMPORT statement to be used to resolve types mentioned in rules. This solves two common problems.

Firstly, this allows you to deploy your Helper classes in a module, making it possible for the Helper to rely on other modules in the runtime to implement the desired Helper behaviour. For example, you might want to inject code into a method of an XTS (Web Services Transactions) class and call a Helper method which validates execution at the trigger point by checking the state of the WS (Web Services) stack. You would deploy your Helper class in a module which imports the necessary WS API classes and then use an IMPORT statement to make your Helper class visible to your rule.

Secondly, your rules can directly reference classes in modules which are not visible from the rule's trigger class. For example, you might want to inject code into an EJB method which traces the execution of the EJB and also displays some of the current JBoss Transaction statistics. Importing the JBoss Transaction module allows your rule to refer to the JBoss Transaction static data & methods which expose these statistics.

Details of how to configure the JBoss Modules plugin and examples of how to import modules will be provided in a separate blog post. If you are interested in using the plugin and want more information or advice please contact the developers either on IRC or on the Byteman user forum.