The AspectJTM 5 Development Kit Developer's Notebook

the AspectJ Team

Copyright (c) 2004 Contributors, All rights reserved.

Abstract

This guide describes the changes to the AspectJ language and tools in AspectJ 5. These include support for Java 5 (Tiger) features, enhancements to load-time weaving, an support for an annotation-based development style for aspects. If you are new to AspectJ, we recommend you start by reading the programming guide.

This is a draft document and is subject to change before the design and implementation is complete. There is also no guarantee that all of the features in this document will be implemented in a 1.5.0 release - some may be deferred until 1.5.1 or even later. In general, features in which we have more confidence in the design will be implemented earlier, providing a framework for user feedback and direction setting on features for which the use cases are less obvious at time of writing.


Table of Contents

1. Join Point Signatures
Join Point Matching
Join Point Signatures
Method call join point signatures
Method execution join point signatures
Field get and set join point signatures
Join Point Modifiers
Summary of Join Point Matching
2. Annotations
Annotations in Java 5
Using Annotations
Retention Policies
Accessing Annotations at Runtime
Annotation Inheritance
Annotating Aspects
Join Point Matching based on Annotations
Annotation Patterns
Type Patterns
Signature Patterns
Example Pointcuts
Runtime type matching and context exposure
Package and Parameter Annotations
Annotation Inheritance and pointcut matching
Limitations
Using Annotations with declare statements
Declare error and declare warning
declare parents
declare precedence
Declare Annotation
Inter-type Declarations
3. Generics
Generics in Java 5
Declaring Generic Types
Using Generic and Parameterized Types
Subtypes, Supertypes, and Assignability
Generic Methods and Constructors
Erasure
Generics in AspectJ 5
Matching generic and parameterized types in type patterns
Signature patterns
Pointcuts
Inter-type Declarations
Declare Parents
Declare Soft
Parameterized Aspects
4. Autoboxing and Unboxing
Autoboxing and Unboxing in Java 5
Autoboxing and Join Point matching in AspectJ 5
Inter-type method declarations and method dispatch
5. Covariance
Covariance in Java 5
Covariant methods and Join Point matching
6. Varargs
Variable-length Argument Lists in Java 5
Calling Methods and Constructors with variable-length arguments
Using Variable-length arguments in advice and pointcut expressions
Matching signatures based on variable length argument types
Exposing variable-length arguments as context in pointcuts and advice
7. Enumerated Types
Enumerated Types in Java 5
Enumerated Types in AspectJ 5
8. The pertypewithin Aspect Instantiation Model
9. An Annotation Based Development Style
Introduction
Aspect Declarations
Pointcuts and Advice
Pointcuts
Advice
Inter-type Declarations
Declare statements
aspectOf() and hasAspect() methods
10. New Reflection Interfaces
The Aspect Class
11. Other Changes in AspectJ 5
Pointcuts
Binding of formals
Additional lint warnings
Declare Soft
Tools
Aspectpath
12. Load-Time Weaving
Introduction
Weaving class files more than once
Load-time Weaving Requirements
Configuration
Enabling Load-time Weaving
Configuring Load-time Weaving with aop.xml files
Configuring Load-time Weaving with Properties Files
Weaver Options
Runtime Requirements for Load-time Weaving
Supported Agents
JVMTI
JRockit
A. A Grammar for the AspectJ 5 Language