Chapter 1. Messages

Table of Contents

Introduction
Configuring Messages
Message scenarios
Compile-time weaving scenarios
Load-time weaving scenarios
Lint messages

Introduction

Messages point out potential problems in the input program; some are clearly problems (errors), but many more may depend on what the programmer intends. To keep the noise down the latter are treated as warnings which can be ignored by the programmer or information which are hidden. However, when investigating unexpected behavior it's helpful to show them. This section describes how to configure messages, presents some problem scenarios when compiling or doing load-time weaving, and summarizes some of the more relevant messages.

Configuring Messages

The compiler offers -verbose, -warning, and -XLint options when invoked using the command-line, Ant, or embedded in an IDE. All options are listed in the AspectJ Development Environment Guide sections for Ajc and Ant Tasks. The Load-time Weaving section describes how to use XML configuration files and system properties to pass options to the weaver. (You can also pass options to the weaver using system properties in build- time weaving.) The -verbose option has the effect of including messages level "info", which are normally ignored. Both warning and XLint enable you to identify specific messages to emit, but warning messages tend to be the same provided by the underlying Eclipse JDT (Java) compiler, while XLint messages are emitted by the AspectJ compiler or weaver. Obviously, during load-time weaving only weaver messages will be emitted. Similarly, if aspects are compiled but not woven, then only compiler messages will be emitted. However, the usual case for the compiler/weaver working at build time is to emit both compiler and weaver messages.

The tables below list some options, System Properties (for LTW only) and Java 5 annotations used to control AspectJ messages. The method of configuration depends on your environment so please refer to the relevant documentation for ajc, Ant or LTW.

OptionDescription
-verbose Show informational messages including AspectJ version and build date.
-debug (Load-time weaving only). Show debugging messages such as which classes are being woven or those that are excluded. (This is not related to the compiler -g option to include debug information in the output .class files.)
-showWeaveInfo Show weaving messages.
-Xlint Control level of lint messages.
messageHolderClass/ -XmessageHolderClass: In Ant tasks and LTW respectively specify the class to receive all messages. See iajc task options or Weaver Options.

System PropertyDescription
aj.weaving.verbose Show informational messages including AspectJ version and build date (same as -verbose option).
org.aspectj.weaver.showWeaveInfo Show weaving messages (same as -showWeaveInfo option).
org.aspectj.weaving.messages Set this system property to enable tracing of all compiler messages. See Configuring Tracing.

AnnotationDescription
@SuppressAjWarnings Include this is Java 5 code to suppress AspectJ warnings associated with the next line of code.