© Copyright 2004 Contributors. All rights reserved.

AspectJ 1.2.1 is largely a bug-fix release and the definition of the AspectJ language is unchanged from the 1.2.0 release (with the exception that AspectJ 1.2.1 permits the use of the '+' operator to concatenate the messages for declare error and warning statements). This document describes the tools differences between AspectJ versions 1.2 and 1.2.1. Users familiar with AspectJ 1.2 may find this document a quicker way to learn what changed in the tools.

This document summarizes changes in:

  • Weaver messages

  • Dump support

  • JDT Compiler version

  • Line number information for join points

  • Runtime performance

  • String concatentation in declare error and warning statements

  • Load-time weaving support

  • Use of aspect libraries generated by ajc 1.2.1 with earlier versions of ajc

See the changes document for more details, or all the changes as detailed in the bugzilla database.

Weaver Informational Messages

The AspectJ 1.2.1 compiler can produce informational messages about the weaving process. To see these messages, use the -showWeaveInfo compiler option, or set showweaveinfo=true in the iajc ant task.

The following is an example of the messages produced when this option is enabled:

C:\aspectj1.2.1\doc\examples\tjp>ajc -showWeaveInfo *.java

Type 'tjp.Demo' (Demo.java:20) advised by around advice from 'tjp.GetInfo'
(GetInfo.java:26) [RuntimeTest=true]

Type 'tjp.Demo' (Demo.java:30) advised by around advice from 'tjp.GetInfo'
(GetInfo.java:26) [RuntimeTest=true]

Type 'tjp.Demo' (Demo.java:34) advised by around advice from 'tjp.GetInfo'
(GetInfo.java:26) [RuntimeTest=true]

Dump Support

In the event of a compiler crash, AspectJ 1.2.1 will produce a dump file giving important information about the state of the compiler at the time of the crash. These dump files should enable us to analyze problems more effectively. In the rare event that you witness a compiler crash, please attach the dump file to the bug report.

In addition to producing a dump file when an abort condition is detected, the AspectJ 1.2.1 compiler can also be requested to create a dump file on detection of a compilation error. Set the property org.aspectj.weaver.Dump.condition=error to enable this behaviour.

JDT Compiler Version

AspectJ 1.2.1 is based on the Eclipse 3.0 final JDT compiler.

Line Number Information for Join Points

For source files compiled by ajc (as opposed to binary inputs to the compiler compiled with some other java compiler), ajc now emits better line number information for execution join points. In particular, for a method, constructor or advice execution join point (as matched for example by a declare error or declare warning statement), ajc 1.2.1 reports the first line number of the declaration, as opposed to the line number of the first line of code in the body.

Runtime Performance

AspectJ 1.2.1 contains a small number of runtime performance optimisations, including optimisations of if(true) and if(false) pointcut expressions, caching of getSignature() and toString() results on JoinPoint objects, and an optimised implementation of cflow.

In the case where there are no arguments bound in the cflow pointcut, programs compiled under AspectJ 1.2.1 and that make heavy use of cflow will run significantly faster. Thanks to the abc compiler team for detecting this performance related bug and for piloting the fix.

String Concatentation in Declare Error/Warning Statements

String concatentation in declare error and warning statements is now supported. For example, you can write:

declare warning : jdbcCall() && !inDataLayer()
                : "Please don't make calls to JDBC " +
                  "outside of the data layer.";

Load-time Weaving Support

The AspectJ 1.2.1 distribution contains a new jar in the lib directory, aspectjweaver.jar, that contains the subset of aspectjtools.jar needed for weaving only. This jar may be used in situations where you wish to exploit AspectJ’s binary weaving capabilities, but do not want the full aspectjtools.jar around (aspectjweaver.jar is approx. 5 times smaller).

In addition, the load-time weaving "aj" script which was included in the doc/examples/ltw directory in the 1.2 distribution has been moved into the regular bin directory. See README-1.2 for details of using this script.

Binary Compatibility

AspectJ 1.2.1 introduces a backwards-incompatible change to the class file format generated by the AspectJ compiler. Classes generated by ajc v1.2.1 cannot be used on the inpath or aspectpath of a weaver from a prior version of the compiler. Classes generated by prior versions of the compiler can of course be placed on the inpath or aspectpath of the 1.2.1 weaver.

As ever, you should use the AspectJ runtime library (aspectjrt.jar) that comes with the distribution you used to build your application.


All changes are listed in the bug database

For a complete list of changes in the 1.2.1 release, search for target 1.2.1 in the bug database: https://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&target_milestone=1.2.1&bug_status=RESOLVED&resolution=FIXED