Chapter 1. Introduction to the AspectJ tools

Table of Contents

The Eclipse AspectJ implementation
Bytecode weaving, incremental compilation, and memory usage
Classpath, inpath, and aspectpath

The Eclipse AspectJ implementation

The AspectJ Programming Guide describes the AspectJ language. This guide describes the AspectJ tools produced by the AspectJ team on http://eclipse.org/aspectj. The AspectJ tools include - ajc, the compiler/weaver; ajdoc, a documentation tool; ajbrowser, a crosscutting code viewer; Ant support for ajc; and load-time weaving support. These tools are delivered in the library folder of the AspectJ tools installation, mainly in aspectjtools.jar (tools) and aspectjrt.jar (runtime). This guide does not describe the Eclipse AspectJ development tools (AJDT). That is produced by another team (sharing some members) on http://eclipse.org/ajdt. AJDT is delivered as an Eclipse plugin, incorporating the classes in the AspectJ tools libraries along with the Eclipse plugin interface classes.

Since AspectJ 1.1, the tools have implemented the AspectJ language using bytecode weaving, which combines aspects and classes to produce .class files that run in a Java VM. There are other ways to implement the language (e.g., compiler preprocessor, VM support); the AspectJ team has always tried to distinguish the language and the implementation so other groups could build alternative implementations of AspectJ. To that end, The AspectJ Programming Guide, Implementation Notes describes how the Java bytecode form affects language semantics. VM- or source-based implementations may be free of these limits or impose limits of their own, but most should be fairly close to what's possible in Java bytecode.

Please be careful not to confuse any description of weaving or of this implementation of the AspectJ language with the AspectJ language semantics. If you do, you might find yourself writing code that doesn't work as expected when you compile or run it on other systems. More importantly, if you think about aspects in terms of weaving or of inserting or merging code, then you can lose many of the design benefits of thinking about an aspect as a single crosscutting module. When the text below introduces an implementation detail, it will warn if users make mistakes by applying it in lieu of the language semantics.