Thursday, 12 December 2013

Byteman 2.1.4 has been released

Byteman release 2.1.4 is now available from the Byteman downloads page and the Maven Central Repository.

This is primarily a bug fix release but it does also introduce a small set of new features and enhancements:
  • class literals (e.g. org.my.Foo.class can now be employed as expressions in Byteman rules
  • scripts can now be loaded from the CLASSPATH as resources using the -javagent option scriptresource:path/to/my/script.btm
  • the offline type checker (and also the maven check plugin) can be configured to check compilation of rules to bytecode
  • the rule parser explicitly catches and notifies missing IF clauses
Many thanks to Antoine Vianey for his contribution to BYTEMAN-255 which fixed the problem where BMUnit was not always working on Windows 7.


Wednesday, 26 June 2013

Better maven integration with the Byteman 2.1.3 release

Byteman 2.1.3 has now been released and is available from Maven Central and from the Byteman downloads page.

As well as fixing a variety of bugs this release also includes some feature enhancements, most notably maven integration of the Byteman rule checker. So now, you can configure your maven project to use the Byteman rulecheck maven plugin and when  you run your maven tests it will ensure that your rule scripts

  -- contain no parse or type errors

  -- will be successfully injected into the specified target classes

The Byteman documentation page includes a link to a simple tutorial which provides before and after examples, demonstrating how to configure the rulecheck plugin and showing how it  catches errors introduced when your project code is updated.

Many thanks to Red Hat's Amos Feng for providing the mojo (not to mention the Mojo) required to enable this valuable feature.

Wednesday, 5 December 2012

Byteman 2.1.2 has been released

Byteman 2.1.2 is now available for download. You can obtain a copy either as a binary-only or full-source zip from the project downloads page or you can depend upon the version available in the Maven Central repository.

Byteman 2.1.2 is for the most part a maintenance update to release 2.1.0, fixing about half a dozen bugs. However, it does include a few new features. In particular:
  • Allow downcasts when initialising local vars in the BIND clause
  • Support computing object size as a standard method in Helper
Downcasting is particularly helpful when dealing with generic types when you know that a specific type parameter is used. For example when injecting into this class

class Foo
{
    void foo(List names)
    . . .
}

downcasting allows you to bind elements of the argument list using the type String rather than the generic type Object

RULE access name as a name
CLASS Foo
METHOD foo
BIND first : String = $names.get(0);
     second : String = $names.get(1);
IF first == "Andrew" && second == "Dinn"
DO throw new Exception("Won't get fooed again!")
ENDRULE

Of course, Byteman performs a checkcast before binding the variables so when the rule executes if you try to downcast a value which is not an instance of the subtype your program will see a ClassCastException.

If you want to disable downcasting and revert to the old behaviour where the type checker flags this as a type error the simply set system property

    org.jboss.byteman.disallow.downcasts

 in the JVM running the Byteman agent.

Thursday, 9 August 2012

Byteman 2.1.0 has been released

Byteman 2.1.0 has just been released and is available from Maven Central and the Byteman downloads page at


This patch release contains a small number of bug fixes and feature upgrades. Many thanks to Ivo Studensky for contributing some nice extensions to the dtest contrib package.

Tuesday, 29 May 2012

Byteman 2.0.3 released and now available from Maven Central

Byteman 2.0.3 has been released and is now accessible from the Byteman downloads page.

Release 2.0.3 is a minor patch upgrade to release 2.0.1 which simply fixes a few minor bugs. However, the main benefit of this release is that the Byteman jars and ZIP file downloads are now distributed via the Maven Central repository.

Tuesday, 13 March 2012

Byteman 2.0.1 Released

The Byteman 2.0.1 release is now available from the JBoss maven repo and from the byteman downloads page.

This is mostly a patch release which fixes a miscellany of small but perfectly formed issues recently uncovered by our intrepid user community. However, it does also include two exciting new functions, contributed courtesy of JBoss community member Kenji Suzuki and our very own Bela Ban:
  • provide Windows batch script equivalents for the Linux command scripts used to drive Byteman (thanks Kenji!
  • modify BMUnit to look for rule scripts mentioned in @BMScript annotations as resources on the classpath before resorting to loading from the local file system (neat idea, Bela!
Enjoy

Wednesday, 8 February 2012

Byteman Talk at FOSDEM

I just got back from my first ever FOSDEM where I spent half my time at the Universite Libre de Bruxelles in the Free Java room hearing some of the latest and finest scoops on free open source Java. The other half of my time was spent in Brussels' old town sampling some of the earliest and finest beers known to mankind. The Java talks were of a very high standard and very entertaining and the questions and answers revealed just how sharp the audience were. As for the beer, well after a Delirium Tremens and several Kasteel Reds at Delirium Cafe it did not seem that life could get any better.

On Saturday just before heading off for the dinner and then on to A La Mort Subite I gave a talk about Byteman to the assembled Java gurus. Heiko Rupp (JBoss RHQ/JON) was in the audience filming. So, (many) thanks to him you can watch the talk as well as download the slides. The links are also posted on the Byteman docs page along with all the other talks and papers from the last few years.

I was immensely surprised, amused and delighted when on Sunday Karl Helgason included an extra off the cuff demo into his talk on his exceptionally clever MIDI synthesizer project Gervill. Karl was very taken with my Byteman demo and was determined to find a way to apply it. So, after dinner on Saturday night he stayed up late reading the Byteman Programmer's Guide and then proceeded to implement a demo which used Byteman to show off Gervill.

Karl injected Byteman rules into implementations of the add, get and remove methods for interface List so that a note or drumbeat was triggered each time they were called. The rule used the integer index argument either to pitch the note or to select the drum to beat. He ran up Tomcat on OpenJDK and after about 3 seconds of intense cacophony summarised the ensuing calm with the single word "bootstrapped".

Karl proceeded to demo his own musical virtuosity, raising laughs from the whole room as he turned the Web GUI into an instrument simply by clicking on its icons and controls. This included zithering the mouse up and down the icons in the title bar which provided a perfectly pitched rising and falling scale. I don't think anyone has ever provided a better example of Tomcat's scalability, performance and fine-tuning.