The AspectJTM Programming Guide

the AspectJ Team

Copyright (c) 1998-2001 Xerox Corporation, 2002-2003 Palo Alto Research Center, Incorporated. All rights reserved.

Abstract

This programming guide describes the AspectJ language. A companion guide describes the tools which are part of the AspectJ development environment.

If you are completely new to AspectJ, you should first read Getting Started with AspectJ for a broad overview of programming in AspectJ. If you are already familiar with AspectJ, but want a deeper understanding, you should read The AspectJ Language and look at the examples in the chapter. If you want a more formal definition of AspectJ, you should read Semantics.


Table of Contents

Preface
1. Getting Started with AspectJ
Introduction
Introduction to AspectJ
The Dynamic Join Point Model
Pointcuts
Advice
Inter-type declarations
Aspects
Development Aspects
Tracing
Profiling and Logging
Pre- and Post-Conditions
Contract Enforcement
Configuration Management
Production Aspects
Change Monitoring
Context Passing
Providing Consistent Behavior
Conclusion
2. The AspectJ Language
Introduction
The Anatomy of an Aspect
An Example Aspect
Pointcuts
Advice
Join Points and Pointcuts
Some Example Pointcuts
call vs. execution
Pointcut composition
Pointcut Parameters
Example: HandleLiveness
Advice
Inter-type declarations
Inter-type Scope
Example: PointAssertions
thisJoinPoint
3. Examples
Introduction
Obtaining, Compiling and Running the Examples
Basic Techniques
Join Points and thisJoinPoint
Roles and Views
Development Aspects
Tracing using aspects
Production Aspects
A Bean Aspect
The Subject/Observer Protocol
A Simple Telecom Simulation
Reusable Aspects
Tracing using Aspects, Revisited
4. Idioms
Introduction
5. Pitfalls
Introduction
Infinite loops
A. AspectJ Quick Reference
Pointcuts
Type Patterns
Advice
Inter-type member declarations
Other declarations
Aspects
B. Language Semantics
Introduction
Join Points
Pointcuts
Pointcut definition
Context exposure
Primitive pointcuts
Signatures
Matching
Type patterns
Pattern Summary
Advice
Advice modifiers
Advice and checked exceptions
Advice precedence
Reflective access to the join point
Static crosscutting
Inter-type member declarations
Access modifiers
Conflicts
Extension and Implementation
Interfaces with members
Warnings and Errors
Softened exceptions
Advice Precedence
Statically determinable pointcuts
Aspects
Aspect Declaration
Aspect Extension
Aspect instantiation
Aspect privilege
C. Implementation Notes
Compiler Notes
Bytecode Notes
The .class expression and String +
The Handler join point
Initializers and Inter-type Constructors
Annotation-style Notes
Summary of implementation requirements