aboutsummaryrefslogtreecommitdiffstats
path: root/docs/pdGuideDB/messages.xml
blob: 9d2caf0b5de0087f1fabb8ad47cf6b75d7e5340e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
<chapter id="messages" xreflabel="Messages">
    <title>Messages</title>

    <sect1 id="messages-introduction">
        <title>Introduction</title>
        <para>
            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.
        </para>
        <sect2 id="messages-introduction-config"
            xreflabel="messages-configuration">
            <title>Configuring Messages</title>
            <para>
                The compiler offers <literal>-verbose</literal>,
                <literal>-warning</literal>, and <literal>-XLint</literal> 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
                <ulink url="../devguide/ajc-ref.html">Ajc</ulink> and
                <ulink url="../devguide/antTasks-iajc.html">Ant Tasks</ulink>.
                The <ulink url="../devguide/ltw.html">Load-time Weaving</ulink>
                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 <literal>-verbose</literal> option has the effect of including
                messages level "info", which are normally ignored.
                Both <literal>warning</literal> and <literal>XLint</literal>
                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.
            </para>

            <para> 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
            <ulink url="../devguide/ajc-ref.html">ajc</ulink>,
            <ulink url="../devguide/antTasks.html">Ant</ulink> or
            <ulink url="../devguide/ltw-configuration.html#weaver-options">LTW</ulink>.
            </para>

            <para>
            <informaltable>
                <tgroup cols="2">
                    <thead>
                        <row>
                            <entry>Option</entry>
                            <entry>Description</entry>
                        </row>
                    </thead>
                    <tbody>
                        <row>
                            <entry>
                                <literal>-verbose</literal>
                            </entry>
                            <entry>
                            	Show informational messages including AspectJ version
                            	and build date.
                            </entry>
                        </row>
                        <row>
                            <entry>
                                <literal>-debug</literal>
                            </entry>
                            <entry>
                            	(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.)
                            </entry>
                        </row>
                        <row>
                            <entry>
                                <literal>-showWeaveInfo</literal>
                            </entry>
                            <entry>
                            	Show weaving messages.
                            </entry>
                        </row>
                        <row>
                            <entry>
                                <literal>-Xlint</literal>
                            </entry>
                            <entry>
                            	Control level of lint messages.
                            </entry>
                        </row>
                        <row>
                            <entry>
                                <literal>messageHolderClass</literal>/
                                <literal>-XmessageHolderClass:</literal>
                            </entry>
                            <entry>
                            	In Ant tasks and LTW respectively specify the class to receive all messages.
                                See
                                <ulink url="../devguide/antTasks-iajc.html#antTasks-iajc-options">
                                iajc task options</ulink> or
                                <ulink url="../devguide/ltw-configuration.html#weaver-options">
                                Weaver Options</ulink>.
                            </entry>
                        </row>

<!-- We need full javadoc for this API
                        <row>
                            <entry>
                                <literal>org.aspectj.tools.Main.setMessageHolder(..)</literal>
                            </entry>
                            <entry>
                            	Programmatic access for setting the message holder
                                outside of Ant.
                            </entry>
                        </row>
-->
                    </tbody>
                </tgroup>
            </informaltable>
			</para>

			<para>
            <informaltable>
                <tgroup cols="2">
                    <thead>
                        <row>
                            <entry>System Property</entry>
                            <entry>Description</entry>
                        </row>
                    </thead>
                    <tbody>
                        <row>
                            <entry>
                                <literal>aj.weaving.verbose</literal>
                            </entry>
                            <entry>
                            	 Show informational messages including AspectJ version and build date
                            	 (same as <literal>-verbose</literal> option).
                            </entry>
                        </row>
                        <row>
                            <entry>
                                <literal>org.aspectj.weaver.showWeaveInfo</literal>
                            </entry>
                            <entry>
                            	Show weaving messages
                            	(same as <literal>-showWeaveInfo</literal> option).
                            </entry>
                        </row>
                        <row>
                            <entry>
                                <literal>org.aspectj.weaving.messages</literal>
                            </entry>
                            <entry>
                            	Set this system property to enable tracing of all compiler
                            	messages. See <xref linkend="trace-configuration"/>.
                            </entry>
                        </row>
                    </tbody>
                </tgroup>
            </informaltable>
            </para>

            <para>
            <informaltable>
                <tgroup cols="2">
                    <thead>
                        <row>
                            <entry>Annotation</entry>
                            <entry>Description</entry>
                        </row>
                    </thead>
                    <tbody>
                        <row>
                            <entry>
                                <literal>@SuppressAjWarnings</literal>
                            </entry>
                            <entry>
                            	Include this is Java 5 code to suppress AspectJ
                                warnings associated with the next line of code.
                            </entry>
                        </row>
                    </tbody>
                </tgroup>
            </informaltable>
            </para>

        </sect2>
    </sect1>
    <sect1 id="messages-scenarios">
        <title>Message scenarios</title>

        <sect2 id="messages-scenarios-ct">
            <title>Compile-time weaving scenarios</title>
            <sect3 id="messages-scenarios-ct-adviceNotWoven">
                <title>Advice not woven</title>
                <para>This means that the pointcut for the advice did not match,
                and it should be debugged as described in
                    <xref linkend="pointcuts"/>.</para>
                </sect3>
        </sect2>

        <sect2 id="messages-scenarios-ltw">
            <title>Load-time weaving scenarios</title>

            <para> You can use <literal>META-INF/aop.xml</literal> to control which
            messages are produced during LTW. The following example will produce
            basic informational messages about the lifecyle of the weaver in
            addition to any warning or error messages. </para>

	        <programlisting><![CDATA[
<aspectj>
    <weaver options="-verbose">
    </weaver>
</aspectj>
]]></programlisting>

            <para>The messages indicate which <literal>META-INF/aop.xml</literal>
            configurations file(s) are being used. Each message is also preceeded by the
            name of the defining class loader associated with weaver. You can use this
            information in a large system to distinguish between different applications each
            of which will typically have its own class loader. </para>

	        <programlisting><![CDATA[
[AppClassLoader@92e78c] info AspectJ Weaver Version 1.5.3 built on Thursday Oct 26, 2006 at 17:22:31 GMT
[AppClassLoader@92e78c] info register classloader sun.misc.Launcher$AppClassLoader@92e78c
[AppClassLoader@92e78c] info using configuration /C:/temp/META-INF/aop.xml
[AppClassLoader@92e78c] info using configuration /C:/temp/META-INF/aop-ajc.xml
[AppClassLoader@92e78c] info register aspect ExceptionHandler
[AppClassLoader@92e78c] info processing reweavable type ExceptionHandler: ExceptionHandler.aj
]]></programlisting>

            <sect3 id="messages-scenarios-ltw-adviceNotWoven">
                <title>Advice not woven</title>
        <para> It is often difficult to determine, especially when using load-time weaving (LTW),
		why advice has not been woven. Here is a quick guide to the messages to
		look for. Firstly if you use the <literal>-verbose</literal> option you
		should see the following message when your aspect is registered: </para>

        <programlisting><![CDATA[
info register aspect MyAspect
]]></programlisting>

		<para> Secondly if you use the <literal>-debug</literal> option you should
		see a message indicating that you class is being woven: </para>

        <programlisting><![CDATA[
debug weaving 'HelloWorld'
]]></programlisting>

		<para> However this does not mean that advice has actually been woven into
		your class; it says that the class has been passed to the weaver. To determine
		whether your pointcuts match you can use the <literal>-showWeaveInfo</literal>
		option which will cause a message to be issued each time a join point is woven: </para>

        <programlisting><![CDATA[
weaveinfo Join point 'method-execution(void HelloWorld.main(java.lang.String[]))' ...
]]></programlisting>

        <para>If advice is woven at this join point you should get the
            corresponding message.</para>
            </sect3>
        </sect2>
    </sect1>

    <sect1 id="messages-xlint">
        <title>Lint messages</title>
                                <para>
                The table below lists some useful <literal>-Xlint</literal> messages. </para>
            <informaltable>
                <tgroup cols="3">
                    <thead>
                        <row>
                            <entry>Message</entry>
                            <entry>Default</entry>
                            <entry>Description</entry>
                        </row>
                    </thead>
                    <tbody>
                        <row>
                            <entry>
                                <literal>aspectExcludedByConfiguration</literal>
                            </entry>
                            <entry>
                                <literal>ignore</literal>
                            </entry>
                            <entry>
                            	If an aspect is not being woven, despite being
                            	registered, it could be that it has been excluded
                            	by either an <literal>include</literal> or <literal>exclude</literal>
                            	element in the
                            	<literal>aspects</literal> section of <literal>META-INF/aop.xml</literal>.
                            	Enable this message to determine whether an aspect has
                            	been excluded.
                            </entry>
                        </row>
                        <row>
                            <entry>
                                <literal>adviceDidNotMatch</literal>
                            </entry>
                            <entry>
                                <literal>warning</literal>
                            </entry>
                            <entry>
                            	Issued when advice did not potentially affect any join points.
                                This means the corresponding pointcut did not match any join
                                points in the program.  This may be valid e.g., in library
                                aspects or code picking up error conditions, but often the
                                programmer simply made a mistake in the pointcut.  The best
                                approach is to debug the pointcut.
                            </entry>
                        </row>
                        <row>
                            <entry>
                                <literal>invalidAbsoluteTypeName</literal>
                            </entry>
                            <entry>
                                <literal>warning</literal>
                            </entry>
                            <entry>
                            	Issued when an exact type in a pointcut does not match any type
                                in the system.  Note that this can interact with the rules for
                                resolving simple types, which permit unqualified names if they
                                are imported.
                            </entry>
                        </row>
                        <row>
                            <entry>
                                <literal>typeNotExposedToWeaver</literal>
                            </entry>
                            <entry>
                                <literal>warning</literal>
                            </entry>
                            <entry>
                            	This means that a type which could be affected by an aspect
                                is not available for weaving.  This happens when a class on
                                the classpath should be woven.
                            </entry>
                        </row>
                        <row>
                            <entry>
                                <literal>runtimeExceptionNotSoftened</literal>
                            </entry>
                            <entry>
                                <literal>warning</literal>
                            </entry>
                            <entry>
                            	Before AspectJ 5, declare soft used to soften runtime exceptions
                                (unnecessarily).  Since then, it does not but does issue this
                                warning in case the programmer did intend for the exception
                                to be wrapped.
                            </entry>
                        </row>
                        <row>
                            <entry>
                                <literal>unmatchedSuperTypeInCall</literal>
                            </entry>
                            <entry>
                                <literal>warning</literal>
                            </entry>
                            <entry>
                            	Issued when a call pointcut specifies a defining type which
                                is not matched at the call site (where the declared type of
                                the reference is used, not the actual runtime type).  Most
                                people should use
                                'target(Foo) &amp;&amp; call(void foo())'
                                instead.
                            </entry>
                        </row>
                    </tbody>
                </tgroup>
            </informaltable>
    </sect1>

</chapter>