The AspectJTM 5 Development Kit Developer's Notebook

the AspectJ Team

Copyright (c) 2004, 2005 Contributors, All rights reserved.

Abstract

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


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
Matching based on annotation values
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 pointcut expressions
Inter-type Declarations
Declare Parents
Declare Soft
Generic 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
Limitations
Pointcuts and Advice
Pointcuts
Advice
Inter-type Declarations
Declare statements
aspectOf() and hasAspect() methods
10. New Reflection Interfaces
Using AjTypeSystem
11. Other Changes in AspectJ 5
Pointcuts
Declare Soft
12. Load-Time Weaving
Introduction