diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-04-10 19:19:39 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-04-10 19:19:39 +0700 |
commit | 92edca3ea7a482d59a9086b1cb61413ed8604b67 (patch) | |
tree | d709ab2fd24a563cf626fb5ff354a0972a1dc6a9 /docs/devGuideDB | |
parent | 79c272eb9c158a976b7b3313c50759dd87b1b5fd (diff) | |
download | aspectj-92edca3ea7a482d59a9086b1cb61413ed8604b67.tar.gz aspectj-92edca3ea7a482d59a9086b1cb61413ed8604b67.zip |
Remove indentation from <programlisting> blocks in docs
Many dozens (hundreds?) of documentation code blocks were indented to
match the surrounding XML or just arbitrarily. The thing is: Inside
<programlisting> tags, similar to <pre> tags, line feeds and leading
whitespace are being preserved, which looked very awkward in the HTML
documentation. While a few files were mostly correct in this respect,
which shows that it was meant to be like that, many others were not.
This was tedious, stupid work to fix, but it had to be done.
Please note that the documentation was in no way updated content-wise.
This is also overdue, but not my focus here.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'docs/devGuideDB')
-rw-r--r-- | docs/devGuideDB/aj.xml | 38 | ||||
-rw-r--r-- | docs/devGuideDB/ajbrowser.xml | 126 | ||||
-rw-r--r-- | docs/devGuideDB/ajc.xml | 279 | ||||
-rw-r--r-- | docs/devGuideDB/ajdb.xml | 74 | ||||
-rw-r--r-- | docs/devGuideDB/ajdee.xml | 75 | ||||
-rw-r--r-- | docs/devGuideDB/antsupport.xml | 947 | ||||
-rw-r--r-- | docs/devGuideDB/aspectj-mode.xml | 23 | ||||
-rw-r--r-- | docs/devGuideDB/ltw.xml | 193 |
8 files changed, 865 insertions, 890 deletions
diff --git a/docs/devGuideDB/aj.xml b/docs/devGuideDB/aj.xml index 1604d540c..fd250d055 100644 --- a/docs/devGuideDB/aj.xml +++ b/docs/devGuideDB/aj.xml @@ -1,9 +1,9 @@ <refentry id="aj-ref" xreflabel="The aj Command-line Reference"> - - <refnamediv> + + <refnamediv> <refname>aj</refname> <refpurpose>command-line launcher for basic load-time weaving</refpurpose> - </refnamediv> + </refnamediv> <refsynopsisdiv> <cmdsynopsis> @@ -16,39 +16,39 @@ </refsynopsisdiv> <refsect1 id="aj" xreflabel="aj"> <title>Description</title> - + <para>The <command>aj</command> command runs Java programs in Java 1.4 or later by setting up <literal>WeavingURLClassLoader</literal> as the system class loader, to do load-time bytecode weaving. </para> - + <para> The arguments are the same as those used to launch the Java program. Users should define the environment variables <literal>CLASSPATH</literal> and <literal>ASPECTPATH</literal>. </para> - + <para>For more information and alternatives for load-time weaving, see <xref linkend="ltw"/>. </para> - + <refsect2> <title>Examples</title> - + <example id="simpleajexample"> <title>A simple example</title> - + <para>Use ajc to build a library, then weave at load time</para> - - <programlisting><![CDATA[ - REM compile library - ${ASPECTJ_HOME}\bin\ajc.bat -outjar lib\aspects.jar @aspects.lst - - REM run, weaving into application at load-time set - ASPECTPATH=lib\aspects.jar set CLASSPATH=app\app.jar - ${ASPECTJ_HOME}\bin\aj.bat com.company.app.Main "Hello, World!" -]]> </programlisting> - + + <programlisting><![CDATA[ +REM compile library +${ASPECTJ_HOME}\bin\ajc.bat -outjar lib\aspects.jar @aspects.lst + +REM run, weaving into application at load-time set +ASPECTPATH=lib\aspects.jar set CLASSPATH=app\app.jar +${ASPECTJ_HOME}\bin\aj.bat com.company.app.Main "Hello, World!" +]]> </programlisting> + </example> </refsect2> </refsect1> diff --git a/docs/devGuideDB/ajbrowser.xml b/docs/devGuideDB/ajbrowser.xml index fd48169bc..a276ca11b 100644 --- a/docs/devGuideDB/ajbrowser.xml +++ b/docs/devGuideDB/ajbrowser.xml @@ -5,33 +5,33 @@ <sect1 id="ajbrowser-intro"> <title>Introduction</title> <para> - AJBrowser presents a GUI for compiling programs with ajc + AJBrowser presents a GUI for compiling programs with ajc and navigating crosscutting structure. </para> <para> The AspectJ Browser can edit program source files, compile using the AspectJ compiler <literal>ajc</literal> run a program, - and graphically navigate the program's + and graphically navigate the program's crosscutting structure. - For more information on <literal>ajc</literal>, + For more information on <literal>ajc</literal>, see <xref linkend="ajc-ref"/>. - - + + </para> - + <para> Launch the browser from the command line either by typing "ajbrowser" to invoke the script in <literal>{aspectj}/bin</literal> - (if AspectJ is installed correctly) + (if AspectJ is installed correctly) or by using the <literal>aspectjtools.jar</literal> directly, and specifying no arguments or some number of - build configuration files + build configuration files (suffix <literal>.lst</literal>): <programlisting> - java -jar aspectj1.1/lib/aspectjtools.jar aspectj1.1/doc/examples/spacewar/debug.lst +java -jar aspectj1.1/lib/aspectjtools.jar aspectj1.1/doc/examples/spacewar/debug.lst </programlisting> </para> @@ -47,35 +47,35 @@ Because <literal>ajc</literal> requires all sources to be specified (at least using the <literal>-sourceroots</literal> option), most users create <literal>.lst</literal> files that list - the files to compile (one argument per line, globbing + the files to compile (one argument per line, globbing permitted - for more details, see <xref linkend="ajc-ref"/>). </para> <para> - To work with a particular program, select the + To work with a particular program, select the corresponding ".lst" build configuration file - from the GUI using the File menu, "open" item, - or by using the + from the GUI using the File menu, "open" item, + or by using the "Open Build Configuration" button (<inlinemediaobject> <imageobject> <imagedata fileref="openConfig.gif"/> </imageobject> </inlinemediaobject>). - + You can populate the build list from the command line - by passing any number of ".lst" paths. - (However, if you pass in any non-".lst" arguments, + by passing any number of ".lst" paths. + (However, if you pass in any non-".lst" arguments, it will run the command-line compiler directly.) </para> <para> To switch between build configurations, select, add, or remove them - using the corresponding toolbar buttons. + using the corresponding toolbar buttons. </para> - <para>Global build options are stored in an + <para>Global build options are stored in an <literal>.ajbrowser</literal> file in your HOME directory. - Edit these from the GUI by clicking the "Options" button - or selecting the Tools menu item "Options...". + Edit these from the GUI by clicking the "Options" button + or selecting the Tools menu item "Options...". This is how to set classpath, aspectpath, etc. </para> <para>The following sections walk through a build. @@ -90,8 +90,8 @@ <imageobject> <imagedata fileref="build.gif"/> </imageobject> - </inlinemediaobject>), or - or use the tools menu. + </inlinemediaobject>), or + or use the tools menu. </para> <!-- <para>To build using AspectJ 1.1's incremental mode, @@ -99,7 +99,7 @@ the <literal>AspectJ Build Options</literal> tab of the <literal>Options</literal> dialog. Once in incremental mode, you can force a full rebuild - by holding the shift key down when selecting the + by holding the shift key down when selecting the build menu item or button. </para> --> @@ -120,7 +120,7 @@ <sect1 id="ajbrowser-navigating"> <title>Navigating Program Structure</title> - + <para> Select nodes in the program structure by clicking them (see label 2). If one node is related to one or more other nodes by an association the @@ -175,9 +175,9 @@ </inlinemediaobject>). Click the <literal>Build Options</literal> tab to view the Build Paths pane. Edit the classpath entry to use your install location. For example, if you ran from the base Aspectj - directory, the classpath need only include + directory, the classpath need only include <literal>lib/aspectjrt.jar</literal> (though the browser may populate - the classpath with the bootclasspath and classpath initially.) + the classpath with the bootclasspath and classpath initially.) Be sure to use the <literal>lib/aspectjrt.jar</literal> that came with the browser. </para> @@ -274,13 +274,13 @@ <literal>affects</literal> relations will list different kinds of join points - constructor or method calls, etc. </para> - <para>Note that the AspectJ browser can only display + <para>Note that the AspectJ browser can only display static structure (whether hierarchical or crosscutting). That means that dynamicly-determined pointcuts (like - <literal>cflow(pointcut)</literal>) + <literal>cflow(pointcut)</literal>) will not be shown as picking out static points in source code. Displayable pointcuts roughly correspond - to those that can be used in a + to those that can be used in a <literal>declare error</literal> statement. </para> </listitem> @@ -297,19 +297,19 @@ You can run in the same VM or spawn a new process; the latter is generally better for GUI programs. </para> - <para>Both require that any classpath you set be specified + <para>Both require that any classpath you set be specified using platform-specific paths and path separators (the compiler might be more tolerant). Output and error streams will be merged into the streams of the browser (using separate threads, so it may take a few seconds for the pipe - threads to gain control.) Errors should + threads to gain control.) Errors should be detected and displayed in a dialog. </para> <para> The GUI does not support killing a running program, so if your program might hang, - be sure to save your files since you may need to + be sure to save your files since you may need to kill the browser itself to kill its child processes. </para> </sect1> @@ -318,36 +318,36 @@ <title>Isolating problems running the AspectJ browser</title> <para> - If you have problems with the browser not solved by the documentation, - please try to see if you have the same problems when running ajc + If you have problems with the browser not solved by the documentation, + please try to see if you have the same problems when running ajc directly on the command line. </para> <itemizedlist> <listitem><para> - If the problem occurs on the command line also, then the problem - is not in the browser. + If the problem occurs on the command line also, then the problem + is not in the browser. (It may be in the compiler; please send bug reports.) </para></listitem> <listitem><para> - If the problem does not occur on the command line, then it may + If the problem does not occur on the command line, then it may lie in the parameters you are supplying in the build options. </para></listitem> <listitem><para> - If the build options look correct and the problem only occurs + If the build options look correct and the problem only occurs when building from the browser, then please submit a bug report. - </para></listitem> + </para></listitem> </itemizedlist> <sect2 id="ajbrowser-knownProblems"> <title>Known issues with the AspectJ browser</title> <para> - For the most up-to-date information on known problems, - see the + For the most up-to-date information on known problems, + see the <ulink url="http://bugs.eclipse.org/bugs">bug database</ulink> - for unresolved + for unresolved <ulink url="http://bugs.eclipse.org/bugs/buglist.cgi?&product=AspectJ&component=Compiler&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED"> compiler bugs - </ulink> or + </ulink> or <ulink url="http://bugs.eclipse.org/bugs/buglist.cgi?&product=AspectJ&component=IDE&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED"> IDE bugs </ulink>. @@ -355,55 +355,55 @@ <para> <itemizedlist> <listitem><para> - Memory and forking: Users email most about the browser task running - out of memory. - This is not a problem with the browser; some compiles take a lot of + Memory and forking: Users email most about the browser task running + out of memory. + This is not a problem with the browser; some compiles take a lot of memory, often more than similar compiles using javac. The browser does not support forking, so the only solution is to edit the java command line or script that launches the browser to add memory. - </para></listitem> + </para></listitem> <listitem><para> Editing build configuration files: this is not currently supported. - </para></listitem> + </para></listitem> <listitem><para> The structure model is incomplete after incremental compiles. To get a complete structure model requires a full build. - </para></listitem> + </para></listitem> <listitem><para> If you change the output directory, you must do a - full build. - </para></listitem> + full build. + </para></listitem> </itemizedlist> - </para> + </para> </sect2> <sect2 id="ajbrowser-limitations"> <title>Limitations</title> - <para> + <para> <itemizedlist> <listitem><para> - The AJBrowser expects the package and directory structure to match. If they do not + The AJBrowser expects the package and directory structure to match. If they do not it will be unable to browse to the corresponding file. - </para></listitem> + </para></listitem> <listitem><para> The "Run" feature launches applications in the same VM. As a result, if a Swing application is disposed the AJBrowser will be disposed as well. - </para></listitem> + </para></listitem> </itemizedlist> </para> </sect2> <sect2 id="ajbrowser-feedback"> <title>AspectJ Browser questions and bugs</title> - <para> - You can send email to + <para> + You can send email to <ulink url="mailto:aspectj-users@dev.eclipse.org"> - aspectj-users@dev.eclipse.org</ulink>. - (Do join the list to participate!) - We also welcome any bug reports, patches, and feature requests; - you can submit them to the bug database at + aspectj-users@dev.eclipse.org</ulink>. + (Do join the list to participate!) + We also welcome any bug reports, patches, and feature requests; + you can submit them to the bug database at <ulink url="http://bugs.eclipse.org/bugs"> http://bugs.eclipse.org/bugs</ulink> - using the AspectJ product and IDE component. + using the AspectJ product and IDE component. </para> </sect2> </sect1> diff --git a/docs/devGuideDB/ajc.xml b/docs/devGuideDB/ajc.xml index dc0db0e04..763c54fba 100644 --- a/docs/devGuideDB/ajc.xml +++ b/docs/devGuideDB/ajc.xml @@ -1,9 +1,9 @@ <refentry id="ajc-ref" xreflabel="The ajc Command-line Reference"> - - <refnamediv> + + <refnamediv> <refname>ajc</refname> <refpurpose>compiler and bytecode weaver for the AspectJ and Java languages</refpurpose> - </refnamediv> + </refnamediv> <refsynopsisdiv> <cmdsynopsis> @@ -19,8 +19,8 @@ <refsect1 id="ajc" xreflabel="ajc"> <title>Description</title> - <para>The <command>ajc</command> command compiles and weaves AspectJ and - Java source and .class files, producing .class files compliant with any + <para>The <command>ajc</command> command compiles and weaves AspectJ and + Java source and .class files, producing .class files compliant with any Java VM (1.1 or later). It combines compilation and bytecode weaving and supports incremental builds; you can also weave bytecode at run-time using <xref linkend="ltw"/>. @@ -29,28 +29,28 @@ <para> The arguments after the options specify the source file(s) to compile. To specify source classes, use <parameter>-inpath</parameter> (below). Files may be listed directly on the command line or in a file. - The <parameter>-argfile <replaceable>file</replaceable></parameter> + The <parameter>-argfile <replaceable>file</replaceable></parameter> and <parameter>@<replaceable>file</replaceable></parameter> forms - are equivalent, and are interpreted as meaning all the arguments - listed in the specified file. + are equivalent, and are interpreted as meaning all the arguments + listed in the specified file. </para> - <para> - <command>Note:</command> + <para> + <command>Note:</command> You must explicitly pass <command>ajc</command> all necessary sources. Be sure to include the source not only for the - aspects or pointcuts but also for any affected types. - Specifying all sources is necessary because, unlike javac, ajc does not + aspects or pointcuts but also for any affected types. + Specifying all sources is necessary because, unlike javac, ajc does not search the sourcepath for classes. (For a discussion of what affected types might be required, see <ulink url="../progguide/implementation.html">The AspectJ Programming Guide, Implementation Appendix</ulink>.) </para> <para> - To specify sources, you can list source files as arguments or use the + To specify sources, you can list source files as arguments or use the options <parameter>-sourceroots</parameter> or <parameter>-inpath</parameter>. If there are multiple sources for any type, the result is undefined - since ajc has no way to determine which source is correct. (This + since ajc has no way to determine which source is correct. (This happens most often when users include the destination directory on the inpath and rebuild.) </para> @@ -71,12 +71,12 @@ <varlistentry> <term>-inpath <replaceable>Path</replaceable></term> <listitem><para> - Accept as source bytecode any .class files in the - .jar files or directories on Path. + Accept as source bytecode any .class files in the + .jar files or directories on Path. The output will include these classes, possibly as woven with any applicable aspects. Path is a single argument containing - a list of paths to zip files or directories, + a list of paths to zip files or directories, delimited by the platform-specific path delimiter. </para></listitem> </varlistentry> @@ -87,7 +87,7 @@ Weave binary aspects from jar files and directories on path into all sources. The aspects should have been output by the same version of the compiler. - When running the output classes, the run classpath should contain + When running the output classes, the run classpath should contain all aspectpath entries. Path, like classpath, is a single argument containing a list of paths to jar files, delimited by the platform- @@ -100,7 +100,7 @@ <listitem><para> The file contains a line-delimited list of arguments. Each line in the file should contain one option, filename, or - argument string (e.g., a classpath or inpath). + argument string (e.g., a classpath or inpath). Arguments read from the file are inserted into the argument list for the command. Relative paths in the file are calculated from the directory containing the file (not the current working directory). @@ -146,8 +146,8 @@ <varlistentry> <term>-sourceroots <replaceable>DirPaths</replaceable></term> - <listitem><para>Find and build all .java or .aj source files under - any directory listed in DirPaths. + <listitem><para>Find and build all .java or .aj source files under + any directory listed in DirPaths. DirPaths, like classpath, is a single argument containing a list of paths to directories, delimited by the platform- specific classpath delimiter. @@ -183,7 +183,7 @@ <listitem><para>Set default level for messages about potential programming mistakes in crosscutting code. {level} may be ignore, warning, or error. - This overrides entries in + This overrides entries in org/aspectj/weaver/XlintDefault.properties from aspectjtools.jar, but does not override levels set using the -Xlintfile option. @@ -193,7 +193,7 @@ <varlistentry> <term>-Xlintfile <replaceable>PropertyFile</replaceable></term> <listitem><para>Specify properties file to set levels for - specific crosscutting messages. + specific crosscutting messages. PropertyFile is a path to a Java .properties file that takes the same property names and values as org/aspectj/weaver/XlintDefault.properties @@ -220,7 +220,7 @@ <listitem><para> Specify where to find user class files. Path is a single argument containing - a list of paths to zip files or directories, + a list of paths to zip files or directories, delimited by the platform-specific path delimiter. </para></listitem> </varlistentry> @@ -228,10 +228,10 @@ <varlistentry> <term>-bootclasspath <replaceable>Path</replaceable></term> <listitem><para> - Override location of VM's bootclasspath + Override location of VM's bootclasspath for purposes of evaluating types when compiling. Path is a single argument containing - a list of paths to zip files or directories, + a list of paths to zip files or directories, delimited by the platform-specific path delimiter. </para></listitem> </varlistentry> @@ -239,10 +239,10 @@ <varlistentry> <term>-extdirs <replaceable>Path</replaceable></term> <listitem><para> - Override location of VM's extension directories + Override location of VM's extension directories for purposes of evaluating types when compiling. Path is a single argument containing - a list of paths to directories, + a list of paths to directories, delimited by the platform-specific path delimiter. </para></listitem> </varlistentry> @@ -251,7 +251,7 @@ <term>-d <replaceable>Directory</replaceable></term> <listitem><para> Specify where to place generated .class files. - If not specified, <replaceable>Directory</replaceable> + If not specified, <replaceable>Directory</replaceable> defaults to the current working dir. </para></listitem> </varlistentry> @@ -264,7 +264,7 @@ <varlistentry> <term>-1.3</term> - <listitem><para>Set compliance level to 1.3 + <listitem><para>Set compliance level to 1.3 This implies -source 1.3 and -target 1.1. </para></listitem> </varlistentry> @@ -288,11 +288,11 @@ <listitem><para>Toggle assertions (1.3, 1.4, or 1.5 - default is 1.4). When using -source 1.3, an assert() statement valid under Java 1.4 will result in a compiler error. - When using -source 1.4, - treat <literal>assert</literal> as a keyword and + When using -source 1.4, + treat <literal>assert</literal> as a keyword and implement assertions according to the 1.4 language spec. When using -source 1.5, - Java 5 language features are permitted. + Java 5 language features are permitted. </para></listitem> </varlistentry> @@ -308,22 +308,22 @@ <varlistentry> <term>-warn: <replaceable>items</replaceable></term> <listitem><para>Emit warnings for any instances of - the comma-delimited list of questionable code + the comma-delimited list of questionable code (eg '-warn:unusedLocals,deprecation'): <programlisting><!-- unable to embed itemizedlist? --> - constructorName method with constructor name - packageDefaultMethod attempt to override package-default method - deprecation usage of deprecated type or member - maskedCatchBlocks hidden catch block - unusedLocals local variable never read - unusedArguments method argument never read - unusedImports import statement not used by code in file - none suppress all compiler warnings +constructorName method with constructor name +packageDefaultMethod attempt to override package-default method +deprecation usage of deprecated type or member +maskedCatchBlocks hidden catch block +unusedLocals local variable never read +unusedArguments method argument never read +unusedImports import statement not used by code in file +none suppress all compiler warnings </programlisting> <literal>-warn:none</literal> does not suppress messages generated by <literal>declare warning</literal> or <literal>Xlint</literal>. - + </para></listitem> </varlistentry> @@ -341,7 +341,7 @@ <varlistentry> <term>-proceedOnError</term> - <listitem><para>Keep compiling after error, + <listitem><para>Keep compiling after error, dumping class files with problem methods </para></listitem> </varlistentry> @@ -351,12 +351,12 @@ <listitem> <para>debug attributes level, that may take three forms: <programlisting> - -g all debug info ('-g:lines,vars,source') - -g:none no debug info - -g:{items} debug info for any/all of [lines, vars, source], e.g., - -g:lines,source +-g all debug info ('-g:lines,vars,source') +-g:none no debug info +-g:{items} debug info for any/all of [lines, vars, source], e.g., + -g:lines,source </programlisting> - + </para></listitem> </varlistentry> @@ -383,16 +383,16 @@ <varlistentry> <term>-verbose</term> - <listitem><para>Emit messages about accessed/processed compilation units + <listitem><para>Emit messages about accessed/processed compilation units </para></listitem> </varlistentry> <varlistentry> <term>-showWeaveInfo</term> - <listitem><para>Emit messages about weaving + <listitem><para>Emit messages about weaving </para></listitem> </varlistentry> - + <varlistentry> <term>-log <replaceable>file</replaceable></term> <listitem><para>Specify a log file for compiler messages. @@ -420,7 +420,7 @@ <varlistentry> <term>-repeat <replaceable>N</replaceable></term> - <listitem><para>Repeat compilation process N times + <listitem><para>Repeat compilation process N times (typically to do performance analysis). </para></listitem> </varlistentry> @@ -430,7 +430,7 @@ <listitem><para>Causes compiler to terminate before weaving </para></listitem> </varlistentry> - + <varlistentry> <term>-XaddSerialVersionUID</term> <listitem><para>Causes the compiler to calculate and add @@ -440,10 +440,10 @@ taken place. </para></listitem> </varlistentry> - + <varlistentry> <term>-Xreweavable[:compress]</term> - <listitem><para>(Experimental - deprecated as now default) + <listitem><para>(Experimental - deprecated as now default) Runs weaver in reweavable mode which causes it to create woven classes that can be rewoven, subject to the restriction that on attempting a reweave all the types that advised the woven type must be accessible. @@ -458,8 +458,8 @@ <varlistentry> <term>-XincrementalFile <replaceable>file</replaceable></term> - <listitem><para>(Experimental) This works like incremental mode, - but using a file rather than standard input to control the compiler. + <listitem><para>(Experimental) This works like incremental mode, + but using a file rather than standard input to control the compiler. It will recompile each time file is changed and and halt when file is deleted. </para></listitem> @@ -497,7 +497,7 @@ </refsect2> - <refsect2> + <refsect2> <title>File names</title> <para>ajc accepts source files with either the <filename>.java</filename> @@ -511,7 +511,7 @@ <para>We'd like to discourage other means of mechanical distinction such as naming conventions or sub-packages in favor of the <filename>.aj</filename> extension.</para> - + <itemizedlist> <listitem><para>Filename conventions are hard to enforce and lead to awkward names @@ -560,7 +560,7 @@ <para>Compile two files:</para> <programlisting> - ajc HelloWorld.java Trace.java +ajc HelloWorld.java Trace.java </programlisting> </example> @@ -569,28 +569,29 @@ <title>An example using -argfile/@</title> <para> - To avoid specifying file names on the command line, + To avoid specifying file names on the command line, list source files in a line-delimited text argfile. Source file paths may be absolute or relative to the argfile, and may include other argfiles by @-reference. The following file <literal>sources.lst</literal> contains absolute and relative files and @-references: </para> - <programlisting> + <programlisting> Gui.java /home/user/src/Library.java data/Repository.java data/Access.java @../../common/common.lst @/home/user/src/lib.lst -view/body/ArrayView.java</programlisting> +view/body/ArrayView.java + </programlisting> <para>Compile the files using either the -argfile or @ form:</para> <programlisting> ajc -argfile sources.lst ajc @sources.lst</programlisting> <para> - Argfiles are also supported by jikes and javac, so you + Argfiles are also supported by jikes and javac, so you can use the files in hybrid builds. However, the support varies: </para> <itemizedlist> @@ -604,110 +605,110 @@ ajc @sources.lst</programlisting> <example id="examplebytecode"> <title>An example using -inpath and -aspectpath</title> <para>Bytecode weaving using -inpath: - AspectJ 1.2 supports weaving .class files in input zip/jar files - and directories. - Using input jars is like compiling the corresponding - source files, and all binaries are emitted to output. Although - Java-compliant compilers may differ in their output, ajc should - take as input any class files produced by javac, jikes, eclipse, + AspectJ 1.2 supports weaving .class files in input zip/jar files + and directories. + Using input jars is like compiling the corresponding + source files, and all binaries are emitted to output. Although + Java-compliant compilers may differ in their output, ajc should + take as input any class files produced by javac, jikes, eclipse, and, of course, ajc. Aspects included in -inpath will be woven into like other .class files, and they will affect other types as usual. </para> <para>Aspect libraries using -aspectpath: - AspectJ 1.1 supports weaving from read-only libraries containing - aspects. Like input jars, they affect all input; unlike input - jars, they themselves are not affected or emitted as output. - Sources compiled with aspect libraries must be run with the same - aspect libraries on their classpath. + AspectJ 1.1 supports weaving from read-only libraries containing + aspects. Like input jars, they affect all input; unlike input + jars, they themselves are not affected or emitted as output. + Sources compiled with aspect libraries must be run with the same + aspect libraries on their classpath. </para> - <para>The following example builds the tracing example in a - command-line environment; it creates a read-only aspect library, - compiles some classes for use as input bytecode, and + <para>The following example builds the tracing example in a + command-line environment; it creates a read-only aspect library, + compiles some classes for use as input bytecode, and compiles the classes and other sources with the aspect library. </para> - <para>The tracing example is in the AspectJ distribution + <para>The tracing example is in the AspectJ distribution ({aspectj}/doc/examples/tracing). This uses the following files: </para> <para><programlisting> - aspectj1.1/ - bin/ - ajc - lib/ - aspectjrt.jar - examples/ - tracing/ - Circle.java - ExampleMain.java - lib/ - AbstractTrace.java - TraceMyClasses.java - notrace.lst - Square.java - tracelib.lst - tracev3.lst - TwoDShape.java - version3/ - Trace.java - TraceMyClasses.java +aspectj1.1/ + bin/ + ajc + lib/ + aspectjrt.jar + examples/ + tracing/ + Circle.java + ExampleMain.java + lib/ + AbstractTrace.java + TraceMyClasses.java + notrace.lst + Square.java + tracelib.lst + tracev3.lst + TwoDShape.java + version3/ + Trace.java + TraceMyClasses.java </programlisting></para> -<para>Below, the path separator is taken as ";", but file separators -are "/". All commands are on one line. Adjust paths and -commands to your environment as needed. +<para>Below, the path separator is taken as ";", but file separators +are "/". All commands are on one line. Adjust paths and +commands to your environment as needed. + +</para><para>Setup the path, classpath, and current directory:</para> -</para><para>Setup the path, classpath, and current directory:</para> - <programlisting> - cd examples - export ajrt=../lib/aspectjrt.jar - export CLASSPATH="$ajrt" - export PATH="../bin:$PATH" +cd examples +export ajrt=../lib/aspectjrt.jar +export CLASSPATH="$ajrt" +export PATH="../bin:$PATH" </programlisting> -<para>Build a read-only tracing library:</para> +<para>Build a read-only tracing library:</para> <programlisting> - ajc -argfile tracing/tracelib.lst -outjar tracelib.jar + ajc -argfile tracing/tracelib.lst -outjar tracelib.jar </programlisting> -<para>Build the application with tracing in one step:</para> +<para>Build the application with tracing in one step:</para> <programlisting> - ajc -aspectpath tracelib.jar -argfile tracing/notrace.lst -outjar tracedapp.jar +ajc -aspectpath tracelib.jar -argfile tracing/notrace.lst -outjar tracedapp.jar </programlisting> -<para>Run the application with tracing:</para> +<para>Run the application with tracing:</para> <programlisting> - java -classpath "$ajrt;tracedapp.jar;tracelib.jar" tracing.ExampleMain +java -classpath "$ajrt;tracedapp.jar;tracelib.jar" tracing.ExampleMain </programlisting> -<para>Build the application with tracing from binaries in two steps:</para> +<para>Build the application with tracing from binaries in two steps:</para> <itemizedlist><listitem><para> -(a) Build the application classes (using javac for demonstration's sake):</para> +(a) Build the application classes (using javac for demonstration's sake):</para> <programlisting> - mkdir classes - javac -d classes tracing/*.java - jar cfM app.jar -C classes . +mkdir classes +javac -d classes tracing/*.java +jar cfM app.jar -C classes . </programlisting> </listitem> <listitem><para> -(b) Build the application with tracing:</para> +(b) Build the application with tracing:</para> <programlisting> - ajc -inpath app.jar -aspectpath tracelib.jar -outjar tracedapp.jar +ajc -inpath app.jar -aspectpath tracelib.jar -outjar tracedapp.jar </programlisting> </listitem></itemizedlist> -<para>Run the application with tracing (same as above):</para> +<para>Run the application with tracing (same as above):</para> <programlisting> - java -classpath "$ajrt;tracedapp.jar;tracelib.jar" tracing.ExampleMain +java -classpath "$ajrt;tracedapp.jar;tracelib.jar" tracing.ExampleMain </programlisting> -<para>Run the application without tracing:</para> +<para>Run the application without tracing:</para> <programlisting> - java -classpath "app.jar" tracing.ExampleMain +java -classpath "app.jar" tracing.ExampleMain </programlisting> </example> @@ -721,7 +722,7 @@ commands to your environment as needed. called as a Java class. The only interface that should be considered public are the public methods in <literal>org.aspectj.tools.ajc.Main</literal>. E.g., <literal>main(String[] args)</literal> takes the - the standard <command>ajc</command> command line arguments. + the standard <command>ajc</command> command line arguments. This means that an alternative way to run the compiler is </para> @@ -736,9 +737,9 @@ commands to your environment as needed. <literal>ajc</literal> reports each message to the holder using <literal>IMessageHolder.handleMessage(..)</literal>. If you just want to collect the messages, use - <literal>MessageHandler</literal> as your + <literal>MessageHandler</literal> as your <literal>IMessageHolder</literal>. - For example, compile and run the following with + For example, compile and run the following with <literal>aspectjtools.jar</literal> on the classpath: </para> <programlisting> @@ -763,19 +764,19 @@ public class WrapAjc { <para>Unlike traditional java compilers, the AspectJ compiler may in certain cases generate classfiles from multiple source files. - Unfortunately, the original Java class file format does not support + Unfortunately, the original Java class file format does not support multiple SourceFile attributes. In order to make sure all source file information is available, the AspectJ compiler may in some cases - encode multiple filenames in the SourceFile attribute. + encode multiple filenames in the SourceFile attribute. When the Java VM generates stack traces, it uses this attribute to specify the source file. </para> <para>(The AspectJ 1.0 compiler also supports the .class file extensions of JSR-45. - These permit compliant debuggers (such as jdb in Java 1.4.1) to identify + These permit compliant debuggers (such as jdb in Java 1.4.1) to identify the right file and line even given many source files for a single class. JSR-45 support is planned for ajc in AspectJ 1.1, but is not in the initial - release. To get fully debuggable .class files, use the -XnoInline option.) + release. To get fully debuggable .class files, use the -XnoInline option.) </para> <para>Probably the only time you may see this format is when you view @@ -787,7 +788,7 @@ java.lang.NullPointerException at Main.new$constructor_call37(Main.java;SynchAspect.java[1k]:1030) </programlisting> - <para>where instead of the usual + <para>where instead of the usual </para> <programlisting> @@ -801,14 +802,14 @@ File:LineNumber File0;File1[Number1];File2[Number2] ... :LineNumber </programlisting> - <para>In this case, LineNumber is the usual offset in lines plus the - "start line" of the actual source file. That means you use LineNumber - both to identify the source file and to find the line at issue. + <para>In this case, LineNumber is the usual offset in lines plus the + "start line" of the actual source file. That means you use LineNumber + both to identify the source file and to find the line at issue. The number in [brackets] after each file tells you the - virtual "start line" for that file (the first file has a start of 0). + virtual "start line" for that file (the first file has a start of 0). </para> - <para> In our example from the null pointer exception trace, + <para> In our example from the null pointer exception trace, the virtual start line is 1030. Since the file SynchAspect.java "starts" at line 1000 [1k], the LineNumber points to line 30 of SynchAspect.java. diff --git a/docs/devGuideDB/ajdb.xml b/docs/devGuideDB/ajdb.xml index 832002823..3af587e4c 100644 --- a/docs/devGuideDB/ajdb.xml +++ b/docs/devGuideDB/ajdb.xml @@ -43,11 +43,11 @@ <para> Note: As of the 1.0.3 release, AspectJ supports JSR-45, which provides source-level debugging from many source files per class - and non-Java source files. - JSR-45 is implemented in the J2SE 1.4 debugger support, so + and non-Java source files. + JSR-45 is implemented in the J2SE 1.4 debugger support, so you may be able to use your existing debugger to step through AspectJ source code if both the source and target VM's are - running under Java 1.4 or later. + running under Java 1.4 or later. However, existing debuggers will display synthetic methods in the stack frame. </para> <!-- todo find docs on JSR-45 --> @@ -132,23 +132,23 @@ spacewar/Ship.java</userinput> which generates the following output: <programlisting> - 209 void fire() { - 210 // firing a shot takes energy - 211 if (!expendEnergy(BULLET_ENERGY)) - 212 return; - 213 - 214 //create a bullet object so it doesn't hit the ship that's firing it - 215 double xV = getXVel() + BULLET_SPEED * (Math.cos(orientation)); - 216 double yV = getYVel() + BULLET_SPEED * (Math.sin(orientation)); - 217 - 218 // create the actual bullet - 219 new Bullet( - 220 getGame(), - 221 (getXPos() + ((getSize()/2 + 2) * (Math.cos(orientation))) + xV), - 222 (getYPos() + ((getSize()/2 + 2) * (Math.sin(orientation))) + yV), - 223 xV, - 224 yV); - 225 } +209 void fire() { +210 // firing a shot takes energy +211 if (!expendEnergy(BULLET_ENERGY)) +212 return; +213 +214 //create a bullet object so it doesn't hit the ship that's firing it +215 double xV = getXVel() + BULLET_SPEED * (Math.cos(orientation)); +216 double yV = getYVel() + BULLET_SPEED * (Math.sin(orientation)); +217 +218 // create the actual bullet +219 new Bullet( +220 getGame(), +221 (getXPos() + ((getSize()/2 + 2) * (Math.cos(orientation))) + xV), +222 (getYPos() + ((getSize()/2 + 2) * (Math.sin(orientation))) + yV), +223 xV, +224 yV); +225 } </programlisting> </para> <para>This is different from <command>jdb</command> because it allows @@ -187,8 +187,8 @@ breakpoint has been noted but will not be set until the class has been loaded by the VM: </para> <programlisting> - Deferring breakpoint spacewar.Ship.fire() - It will be set after the class is loaded. +Deferring breakpoint spacewar.Ship.fire() +It will be set after the class is loaded. </programlisting> <para> @@ -198,14 +198,14 @@ <para> When the breakpoint is set, the following message appears: <programlisting> - Set deferred breakpoint spacewar.Ship.fire() +Set deferred breakpoint spacewar.Ship.fire() </programlisting> </para> <para> We are notified that we've hit the breakpoint: <programlisting> - Breakpoint hit: thread="Thread-2", spacewar.Ship.fire(), line=174, bci=0 209 void fire() { +Breakpoint hit: thread="Thread-2", spacewar.Ship.fire(), line=174, bci=0 209 void fire() { </programlisting></para> <para> @@ -213,10 +213,10 @@ can view the current stack with the <literal>where</literal> command, as follows: <programlisting> - Thread-2[1] where - [1] fire (spacewar\Ship.java:209) - [2] run (spacewar\Robot.java:100) - [3] run [class java.lang.Thread] +Thread-2[1] where +[1] fire (spacewar\Ship.java:209) +[2] run (spacewar\Robot.java:100) +[3] run [class java.lang.Thread] </programlisting> </para> @@ -228,23 +228,23 @@ <para> The following message tells us the breakpoint was set: <programlisting> - Set breakpoint Ship.java:216 +Set breakpoint Ship.java:216 </programlisting> </para> <para> To continue execution, we type <userinput>cont</userinput> and the breakpoint at line 216 is hit <programlisting> - Breakpoint hit: thread="Thread-2", spacewar.Ship.fire(), line=216, bci=28 - 216 double yV = getYVel() + BULLET_SPEED * (Math.sin(orientation)); +Breakpoint hit: thread="Thread-2", spacewar.Ship.fire(), line=216, bci=28 +216 double yV = getYVel() + BULLET_SPEED * (Math.sin(orientation)); </programlisting></para> <para> To view the visible local variables, we type <userinput>locals</userinput> and ajdb responds with: <programlisting> - Local variables - xV = 12.242462584304468 +Local variables +xV = 12.242462584304468 </programlisting></para> <para> @@ -252,22 +252,22 @@ <userinput>set xV = 16.1</userinput> <programlisting> - Changed 'xV' from '12.242462584304468' to '16.1' +Changed 'xV' from '12.242462584304468' to '16.1' </programlisting></para> <para> To see our changes we can print the value of <literal>i</literal> by the following: <programlisting> - print xV - Value for printing 'xV' = 12.242462584304468 +print xV +Value for printing 'xV' = 12.242462584304468 </programlisting></para> <para>We can now type exit or quit to leave the debugger, and we receive the following message: <programlisting> - The application has exited. +The application has exited. </programlisting></para> </example> diff --git a/docs/devGuideDB/ajdee.xml b/docs/devGuideDB/ajdee.xml index 7c42a90fd..652a82f7b 100644 --- a/docs/devGuideDB/ajdee.xml +++ b/docs/devGuideDB/ajdee.xml @@ -274,22 +274,23 @@ your <literal>load-path</literal> and are ``required''. This is an example for the 1.0 release: <programlisting> - ;; I keep my emacs packages in C:/Emacs - (setq load-path - (append - '( - "C:/Emacs/aspectj-emacsMode-1.0" ; for AJDEE - "C:/Emacs/aspectj-emacsAJDEE-1.0" - "C:/Emacs/jde-2.2.9beta6/lisp" - "C:/Emacs/elib-1.0" ; for JDEE - "C:/Emacs/speedbar-0.14beta2" ; for JDEE - "C:/Emacs/semantic-1.4beta12" ; for JDEE/speedbar - "C:/Emacs/eieio-0.17beta3" ; for JDEE - ) - load-path)) - - (require 'jde) - (require 'ajdee) ; can also appear in prj.el</programlisting> + ;; I keep my emacs packages in C:/Emacs + (setq load-path + (append +'( + "C:/Emacs/aspectj-emacsMode-1.0" ; for AJDEE + "C:/Emacs/aspectj-emacsAJDEE-1.0" + "C:/Emacs/jde-2.2.9beta6/lisp" + "C:/Emacs/elib-1.0" ; for JDEE + "C:/Emacs/speedbar-0.14beta2" ; for JDEE + "C:/Emacs/semantic-1.4beta12" ; for JDEE/speedbar + "C:/Emacs/eieio-0.17beta3" ; for JDEE + ) +load-path)) + + (require 'jde) + (require 'ajdee) ; can also appear in prj.el + </programlisting> </para> </listitem> @@ -315,31 +316,33 @@ Here is a simple example: <programlisting> - ;; A default version for simple projects, maybe good for - ;;; .emacs file. - (custom-set-variables - '(jde-compiler '("ajc" "ajc")) - '(jde-javadoc-command-path "ajdoc") +;; A default version for simple projects, maybe good for +;;; .emacs file. +(custom-set-variables +'(jde-compiler '("ajc" "ajc")) +'(jde-javadoc-command-path "ajdoc") - ;; ajc requires all files to be named for a compile - '(aspectj-compile-file-specification "*.java"))</programlisting> +;; ajc requires all files to be named for a compile +'(aspectj-compile-file-specification "*.java")) + </programlisting> Here is an example for spacewar, in <filename>examples/spacewar</filename>. <programlisting> - ;;; These options are for the spacewar, in examples/spacewar. - (custom-set-variables - '(jde-compiler '("ajc" "ajc")) - '(jde-javadoc-command-path "ajdoc") - - ;; ajc provides an ``argfile'' mechanism for specifying all files. - '(aspectj-compile-file-specification "-argfile demo.lst") - - ;; *if* compiling packages, name root dir for package hierarchy - ;; to tell ajc where .class files should go. - '(jde-compile-option-directory "..") - '(jde-run-working-directory "..")) - '(jde-run-application-class "spacewar.Game")</programlisting> +;;; These options are for the spacewar, in examples/spacewar. +(custom-set-variables +'(jde-compiler '("ajc" "ajc")) +'(jde-javadoc-command-path "ajdoc") + +;; ajc provides an ``argfile'' mechanism for specifying all files. +'(aspectj-compile-file-specification "-argfile demo.lst") + +;; *if* compiling packages, name root dir for package hierarchy +;; to tell ajc where .class files should go. +'(jde-compile-option-directory "..") +'(jde-run-working-directory "..")) +'(jde-run-application-class "spacewar.Game") + </programlisting> </para> </listitem> <listitem> diff --git a/docs/devGuideDB/antsupport.xml b/docs/devGuideDB/antsupport.xml index 79b0d99a4..2414bac8e 100644 --- a/docs/devGuideDB/antsupport.xml +++ b/docs/devGuideDB/antsupport.xml @@ -6,86 +6,82 @@ <title>Introduction</title> <para> - AspectJ contains a compiler, <literal>ajc</literal>, - that can be run from Ant. + AspectJ contains a compiler, <literal>ajc</literal>, + that can be run from Ant. Included in the <literal>aspectjtools.jar</literal> - are Ant binaries to support three + are Ant binaries to support three ways of running the compiler: <orderedlist> <listitem> <para> - <xref linkend="antTasks-iajc"/>, - a task to run the AspectJ post-1.1 compiler, + <xref linkend="antTasks-iajc"/>, + a task to run the AspectJ post-1.1 compiler, which supports all the eclipse and ajc options, including incremental mode. </para> </listitem> <listitem> <para> - <xref linkend="antTasks-adapter"/>, - an adapter class to run the new compiler using Javac tasks + <xref linkend="antTasks-adapter"/>, + an adapter class to run the new compiler using Javac tasks by setting the build.compiler property </para> </listitem> <listitem> <para> - <xref linkend="antTasks-ajc"/>, + <xref linkend="antTasks-ajc"/>, a task to run build scripts compatible with the AspectJ 1.0 tasks </para> </listitem> </orderedlist> </para> - + <para> - This describes how to install and use the tasks and the adapter. - For an example Ant script, see + This describes how to install and use the tasks and the adapter. + For an example Ant script, see <ulink url="../examples/build.xml">examples/build.xml</ulink>. </para> </sect1> - + <!-- . . . . . . . . . . . . . . . . . . . . . . . . . . . install --> <sect1 id="antTasks-install" xreflabel="Installing Ant Tasks"> <title>Installing Ant Tasks</title> <para> - Install Jakarta Ant 1.5.1: - Please see the official Jakarta Ant website for more information - and the 1.5.1 distribution. This release is source-compatible - with Ant 1.3 and Ant 1.4, but the task sources must be - compiled with those versions of the Ant libraries to be used - under those versions of Ant. - Sources are available under the Eclipse Public License v. 1.0 + Install Jakarta Ant 1.5.1: + Please see the official Jakarta Ant website for more information + and the 1.5.1 distribution. This release is source-compatible + with Ant 1.3 and Ant 1.4, but the task sources must be + compiled with those versions of the Ant libraries to be used + under those versions of Ant. + Sources are available under the Eclipse Public License v. 1.0 at <ulink url="http://eclipse.org/aspectj">http://eclipse.org/aspectj</ulink>. </para> <para> - In Ant 1.5, third-party tasks can be declared using a taskdef entry in - the build script, to identify the name and classes. - When declaring a task, include the - <literal>aspectjtools.jar</literal> either in the - taskdef classpath or in <literal>${ANT_HOME}/lib</literal> where it will be added - to the system class path by the ant script. - You may specify the task script names directly, + In Ant 1.5, third-party tasks can be declared using a taskdef entry in + the build script, to identify the name and classes. + When declaring a task, include the + <literal>aspectjtools.jar</literal> either in the + taskdef classpath or in <literal>${ANT_HOME}/lib</literal> where it will be added + to the system class path by the ant script. + You may specify the task script names directly, or use the "resource" attribute to specify the default names: </para> - <programlisting> - <![CDATA[ - <taskdef - resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"/> -]]> - </programlisting> + <programlisting><![CDATA[ +<taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"/> +]]></programlisting> <para> - The current resource file retains the name "ajc" for the Ajc10 task, + The current resource file retains the name "ajc" for the Ajc10 task, and uses "iajc" for the AspectJ post-1.1 task. </para> <para> - In Ant 1.6, third-party tasks are declared in their own namespace + In Ant 1.6, third-party tasks are declared in their own namespace using <literal>antlib.xml</literal>. For example, the following script would build and run the spacewar example, if you put the script in the examples directory and <literal>aspectjtools.jar</literal> in the <literal>${ANT_HOME}/lib</literal> directory. </para> - <programlisting> - <![CDATA[ -<project name="aspectj-ant1.6" default="spacewar" + <programlisting><![CDATA[ +<project name="aspectj-ant1.6" default="spacewar" xmlns:aspectj="antlib:org.aspectj" basedir="."> <target name="spacewar"> <aspectj:iajc @@ -97,10 +93,9 @@ classpath="spacewar.jar:../../lib/aspectjrt.jar"/> </target> </project> -]]> - </programlisting> +]]></programlisting> <para> - For more information on using Ant, please refer to Jakarta's + For more information on using Ant, please refer to Jakarta's documentation on integrating user-defined Ant tasks into builds. </para> @@ -109,51 +104,51 @@ <sect1 id="antTasks-iajc" xreflabel="AjcTask (iajc)"> <title>AjcTask (iajc)</title> <para> - This task uses the AspectJ post-1.1 compiler ajc. - The AspectJ compiler can be used like Javac to compile Java sources, - but it can also compile AspectJ sources or weave binary aspects - with Java bytecode. - It can run in normal "batch" mode or in an "incremental" mode, - where it only recompiles files it has to revisit. + This task uses the AspectJ post-1.1 compiler ajc. + The AspectJ compiler can be used like Javac to compile Java sources, + but it can also compile AspectJ sources or weave binary aspects + with Java bytecode. + It can run in normal "batch" mode or in an "incremental" mode, + where it only recompiles files it has to revisit. For more information on ajc, see <xref linkend="ajc-ref"/>. - Unlike Javac or the Javac Ant task, this task always compiles the + Unlike Javac or the Javac Ant task, this task always compiles the specified files since aspects can apply to other (updated) files. For a workaround, see <xref linkend="antTasks-iajc-uptodate"/>. </para> <para> Beyond the normal ajc compiler options, this task also supports an experimental option for an incremental "tag" file, and it - can copy resources from source directories or + can copy resources from source directories or input jars to the output jar or directory. </para> - + <para> - This task is named iajc to avoid conflict with the 1.0 task ajc. + This task is named iajc to avoid conflict with the 1.0 task ajc. </para> <sect2 id="antTasks-iajc-options" xreflabel="AjcTask (iajc) Options"> <title>AjcTask (iajc) Options</title> <para> - The following tables list the supported parameters. - For any parameter specified as a Path, a single path can be - specified directly as an attribute, - multiple paths can be specified using a nested element of + The following tables list the supported parameters. + For any parameter specified as a Path, a single path can be + specified directly as an attribute, + multiple paths can be specified using a nested element of the same name, and a common path can be reused by defining it as a - global and passing the id to the corresponding {name}ref attribute. - See <xref linkend="antTasks-iajc-paths"/> + global and passing the id to the corresponding {name}ref attribute. + See <xref linkend="antTasks-iajc-paths"/> below for more details. </para> <para> - Most attributes and nested elements are optional. - The compiler requires that the same version of + Most attributes and nested elements are optional. + The compiler requires that the same version of <literal>aspectjrt.jar</literal> be specified on the classpath, and that some sources be be specified - (using one or more of + (using one or more of <literal>sourceroots</literal>, <literal>injars</literal>, <literal>inpath</literal>, - <literal>argfiles</literal>, and/or + <literal>argfiles</literal>, and/or <literal>srcdir</literal> (with patterns)). When in incremental mode, only <literal>sourceroots</literal> may be specified. @@ -163,14 +158,14 @@ </para> <!-- . . . . . . . . . . . . . . . . iajc options table --> - <!-- table (and caption/title) not supported by fop --> + <!-- table (and caption/title) not supported by fop --> <para> <emphasis role="strong"> AjcTask (iajc) options for specifying sources - </emphasis> - </para> + </emphasis> + </para> <informaltable> - + <tgroup cols="2"> <thead> <row> @@ -184,9 +179,9 @@ (<xref linkend="antTasks-iajc-paths"/>) </para></entry> <entry><para> - An argument file contains a list of arguments read by the compiler. - Each line is read into one element of the argument array - and may include another argfile by reference. + An argument file contains a list of arguments read by the compiler. + Each line is read into one element of the argument array + and may include another argfile by reference. </para></entry> </row> <row> @@ -194,19 +189,19 @@ (<xref linkend="antTasks-iajc-paths"/>) </para></entry> <entry><para> - Directories containing source files (ending with .java or .aj) to compile. + Directories containing source files (ending with .java or .aj) to compile. </para></entry> </row> <row> <entry><para>srcdir (<xref linkend="antTasks-iajc-paths"/>) </para></entry> - <entry><para> - Base directory of sources to compile, assuming there are + <entry><para> + Base directory of sources to compile, assuming there are <xref linkend="antTasks-nested-includes"/>. - This approach uses the Ant process - for matching .java files and is not compatible with incremental - mode. Unless using filters to limit the sources included, + This approach uses the Ant process + for matching .java files and is not compatible with incremental + mode. Unless using filters to limit the sources included, use sourceroots instead. </para></entry> </row> @@ -226,7 +221,7 @@ </para></entry> <entry><para> Read .class files for bytecode weaving - from directories or zip files (like classpath). + from directories or zip files (like classpath). </para></entry> </row> <row> @@ -244,25 +239,25 @@ (<xref linkend="antTasks-iajc-paths"/>) </para></entry> <entry><para> - The bootclasspath specifies types to use instead of the - invoking VM's when seeking types during compilation. + The bootclasspath specifies types to use instead of the + invoking VM's when seeking types during compilation. </para></entry> </row> <row> <entry><para>extDirs, extDirsRef (<xref linkend="antTasks-iajc-paths"/>) </para></entry> - <entry><para> - The extension directories to use instead of those in the - invoking VM when seeking types during compilation. + <entry><para> + The extension directories to use instead of those in the + invoking VM when seeking types during compilation. </para></entry> </row> <row> <entry><para>aspectPath, aspectPathRef (<xref linkend="antTasks-iajc-paths"/>) </para></entry> - <entry><para> - Similar to classpath, aspectpath contains read-only, + <entry><para> + Similar to classpath, aspectpath contains read-only, binary aspect libraries that are woven into sources but not included in the output. <literal>aspectpath</literal> accepts jar/zip files @@ -271,13 +266,13 @@ </row> </tbody> </tgroup> - </informaltable> + </informaltable> <para> <emphasis role="strong"> AjcTask (iajc) options for specifying output - </emphasis> - </para> + </emphasis> + </para> <informaltable> <tgroup cols="2"> <thead> @@ -290,18 +285,18 @@ <row> <entry><para>destDir </para></entry> - <entry><para> - The directory in which to place the generated class files. - Only one of <literal>destDir</literal> and + <entry><para> + The directory in which to place the generated class files. + Only one of <literal>destDir</literal> and <literal>outJar</literal> may be set. </para></entry> </row> <row> <entry><para>outJar </para></entry> - <entry><para> - The zip file in which to place the generated output class files. - Only one of <literal>destDir</literal> and + <entry><para> + The zip file in which to place the generated output class files. + Only one of <literal>destDir</literal> and <literal>outJar</literal> may be set. </para></entry> </row> @@ -309,9 +304,9 @@ <entry><para>copyInjars </para></entry> <entry><para> - (Deprecated/ignored; ajc does this.) - If true, copy all non-.class files from input jar(s) - to the output jar or destination directory after the + (Deprecated/ignored; ajc does this.) + If true, copy all non-.class files from input jar(s) + to the output jar or destination directory after the compile (or incremental compile) completes. In forked mode, this copies only after the process completes, not after incremental compiles. @@ -320,13 +315,13 @@ <row> <entry><para>sourceRootCopyFilter </para></entry> - <entry><para> - When set, copy all files from the sourceroot directories to the output jar - or destination directory except those specified in the filter pattern. - The pattern should be compatible with an Ant fileset excludes filter; - when using this, most developers pass - <literal>**/CVS/*,**/*.java</literal> to exclude any CVS directories - or source files. + <entry><para> + When set, copy all files from the sourceroot directories to the output jar + or destination directory except those specified in the filter pattern. + The pattern should be compatible with an Ant fileset excludes filter; + when using this, most developers pass + <literal>**/CVS/*,**/*.java</literal> to exclude any CVS directories + or source files. See <literal>inpathDirCopyFilter</literal>. Requires <literal>destDir</literal> or <literal>outJar</literal>. </para></entry> @@ -335,30 +330,30 @@ <entry><para>inpathDirCopyFilter </para></entry> <entry> - <para> When set, copy all files from the inpath directories - to the output jar or destination directory except those - specified in the filter pattern. The pattern should be - compatible with an Ant fileset excludes filter; when - using this, most developers pass - <literal>**/CVS/*,**/*.java,**/*.class</literal> to - exclude any CVS directories, source files, or unwoven - .class files. (If <literal>**/*.class</literal> is not - specified, it will be prepended to the filter.) See - <literal>sourceRootCopyFilter</literal>. (Note that ajc - itself copies all resources from input jar/zip files on - the inpath.) Requires <literal>destDir</literal> or + <para> When set, copy all files from the inpath directories + to the output jar or destination directory except those + specified in the filter pattern. The pattern should be + compatible with an Ant fileset excludes filter; when + using this, most developers pass + <literal>**/CVS/*,**/*.java,**/*.class</literal> to + exclude any CVS directories, source files, or unwoven + .class files. (If <literal>**/*.class</literal> is not + specified, it will be prepended to the filter.) See + <literal>sourceRootCopyFilter</literal>. (Note that ajc + itself copies all resources from input jar/zip files on + the inpath.) Requires <literal>destDir</literal> or <literal>outJar</literal>.</para> </entry> </row> </tbody> </tgroup> - </informaltable> + </informaltable> <para> <emphasis role="strong"> AjcTask (iajc) options for specifying compiler behavior - </emphasis> - </para> + </emphasis> + </para> <informaltable> <tgroup cols="2"> <thead> @@ -371,16 +366,16 @@ <row> <entry><para>fork </para></entry> - <entry><para> - Run process in another VM. + <entry><para> + Run process in another VM. This gets the forking classpath either explicitly - from a <literal>forkclasspath</literal> entry + from a <literal>forkclasspath</literal> entry or by searching the task or system/Ant classpath for the first readable file with a name of the form <literal>aspectj{-}tools{.*}.jar</literal>. When forking you can specify the amount of memory used with <literal>maxmem</literal>. - Fork cannot be used in incremental mode, + Fork cannot be used in incremental mode, unless using a tag file. </para></entry> </row> @@ -395,38 +390,38 @@ <row> <entry><para>maxmem </para></entry> - <entry><para> - The maximum memory to use for the new VM when fork is true. - Values should have the same form as accepted by the VM, e.g., "128m". + <entry><para> + The maximum memory to use for the new VM when fork is true. + Values should have the same form as accepted by the VM, e.g., "128m". </para></entry> </row> <row> <entry><para>incremental </para></entry> - <entry><para> - incremental mode: Build once, then recompile only required source - files when user provides input. - Requires that source files be specified only using - <literal>sourceroots</literal>. + <entry><para> + incremental mode: Build once, then recompile only required source + files when user provides input. + Requires that source files be specified only using + <literal>sourceroots</literal>. Incompatible with forking. </para></entry> </row> <row> <entry><para>tagfile </para></entry> - <entry><para> - incremental mode: Build once, then recompile only required source - files when the tag file is updated, finally exiting when tag file + <entry><para> + incremental mode: Build once, then recompile only required source + files when the tag file is updated, finally exiting when tag file is deleted. - Requires that source files be specified only using - <literal>sourceroots</literal>. + Requires that source files be specified only using + <literal>sourceroots</literal>. </para></entry> </row> <row> <entry><para>X </para></entry> <entry><para> - Set experimental option(s), using comma-separated list of accepted options + Set experimental option(s), using comma-separated list of accepted options Options should not contain the leading X. Some commonly-used experimental options have their own entries. The other permitted ones (currently) are @@ -447,12 +442,12 @@ </row> </tbody> </tgroup> - </informaltable> + </informaltable> <para> <emphasis role="strong"> AjcTask (iajc) options for specifying compiler side-effects and messages - </emphasis> + </emphasis> </para> <informaltable> <tgroup cols="2"> @@ -489,37 +484,37 @@ </para></entry> <entry><para> If true, log compiler command elements as Project.INFO - (rather than the usual Project.VERBOSE level). + (rather than the usual Project.VERBOSE level). </para></entry> </row> <row> <entry><para>Xlistfileargs </para></entry> - <entry><para> - If true, emit list of file arguments during - the compile (but behaves now like verbose). + <entry><para> + If true, emit list of file arguments during + the compile (but behaves now like verbose). </para></entry> </row> <row> <entry><para>version </para></entry> - <entry><para> + <entry><para> If true, do not compile - just print AspectJ version. </para></entry> </row> <row> <entry><para>help </para></entry> - <entry><para> - If true, just print help for the command-line compiler. + <entry><para> + If true, just print help for the command-line compiler. </para></entry> </row> <row> <entry><para>Xlintwarnings </para></entry> - <entry><para> + <entry><para> Same as <literal>xlint:warning</literal>: - if true, set default level of all language + if true, set default level of all language usage messages to warning. </para></entry> </row> @@ -527,24 +522,24 @@ <entry><para>Xlint </para></entry> <entry><para> - Specify default level of all language usage messages to one of - [<literal>error warning ignore</literal>]. + Specify default level of all language usage messages to one of + [<literal>error warning ignore</literal>]. </para></entry> </row> <row> <entry><para>XlintFile </para></entry> - <entry><para> - Specify property file containing <literal>name:level</literal> associations - setting level for language messages emitted during compilation. - Any levels set override the default associations in - <literal>org/aspectj/weaver/XLintDefault.properties</literal>. + <entry><para> + Specify property file containing <literal>name:level</literal> associations + setting level for language messages emitted during compilation. + Any levels set override the default associations in + <literal>org/aspectj/weaver/XLintDefault.properties</literal>. </para></entry> </row> <row> <entry><para>failonerror </para></entry> - <entry><para> + <entry><para> If true, throw BuildException to halt build if there are any compiler errors. If false, continue notwithstanding compile errors. @@ -554,31 +549,31 @@ <row> <entry><para>messageHolderClass </para></entry> - <entry><para> - Specify a class to use as the message holder for the compile process. - The entry must be a fully-qualified name of a class resolveable from - the task classpath complying with the - <literal>org.aspectj.bridge.IMessageHolder</literal> interface - and having a public no-argument constructor. + <entry><para> + Specify a class to use as the message holder for the compile process. + The entry must be a fully-qualified name of a class resolveable from + the task classpath complying with the + <literal>org.aspectj.bridge.IMessageHolder</literal> interface + and having a public no-argument constructor. </para></entry> </row> <row> <entry><para>showWeaveInfo </para></entry> - <entry><para> + <entry><para> If true, emit weaver messages. Defaults to <literal>false</literal>. </para></entry> </row> </tbody> </tgroup> - </informaltable> + </informaltable> <para> <emphasis role="strong"> AjcTask (iajc) options for specifying Eclipse compiler options - </emphasis> + </emphasis> </para> <informaltable> <tgroup cols="2"> @@ -592,32 +587,32 @@ <row> <entry><para>nowarn </para></entry> - <entry><para> + <entry><para> If true, same as <literal>warn:none</literal>. </para></entry> </row> <row> <entry><para>deprecation </para></entry> - <entry><para> - If true, same as <literal>warn:deprecation</literal> + <entry><para> + If true, same as <literal>warn:deprecation</literal> </para></entry> </row> <row> <entry><para>warn </para></entry> - <entry><para> + <entry><para> One or more comma-separated warning specifications from - [<literal>constructorName packageDefaultMethod deprecation, - maskedCatchBlocks unusedLocals unusedArguments, - unusedImports syntheticAccess assertIdentifier</literal>]. + [<literal>constructorName packageDefaultMethod deprecation, + maskedCatchBlocks unusedLocals unusedArguments, + unusedImports syntheticAccess assertIdentifier</literal>]. </para></entry> </row> <row> <entry><para>debug </para></entry> <entry><para> - If true, same as <literal>debug:lines,vars,source</literal> + If true, same as <literal>debug:lines,vars,source</literal> </para></entry> </row> <row> @@ -625,79 +620,79 @@ </para></entry> <entry><para> One or more comma-separated debug specifications from - [<literal>lines vars source</literal>]. + [<literal>lines vars source</literal>]. </para></entry> </row> <row> <entry><para>PreserveAllLocals </para></entry> - <entry><para> - If true, code gen preserves all local variables (for debug purposes). + <entry><para> + If true, code gen preserves all local variables (for debug purposes). </para></entry> </row> <row> <entry><para>noimporterror </para></entry> - <entry><para> - If true, emit no errors for unresolved imports. + <entry><para> + If true, emit no errors for unresolved imports. </para></entry> </row> <row> <entry><para>referenceinfo </para></entry> - <entry><para> - If true, compute reference info. + <entry><para> + If true, compute reference info. </para></entry> </row> <row> <entry><para>log </para></entry> - <entry><para> - File to log compiler messages to. + <entry><para> + File to log compiler messages to. </para></entry> </row> <row> <entry><para>encoding </para></entry> <entry><para>Default source encoding format - (per-file encoding not supported in Ant tasks). + (per-file encoding not supported in Ant tasks). </para></entry> </row> <row> <entry><para>proceedOnError </para></entry> - <entry><para> - If true, keep compiling after errors encountered, - dumping class files with problem methods. + <entry><para> + If true, keep compiling after errors encountered, + dumping class files with problem methods. </para></entry> </row> <row> <entry><para>progress </para></entry> - <entry><para> - If true, emit progress (requires log). + <entry><para> + If true, emit progress (requires log). </para></entry> </row> <row> <entry><para>time </para></entry> - <entry><para> - If true, display speed information. + <entry><para> + If true, display speed information. </para></entry> </row> <row> <entry><para>target </para></entry> - <entry><para> + <entry><para> Specify target class file format as one of [<literal>1.1 1.2</literal>]. - Defaults to 1.1 class file. + Defaults to 1.1 class file. </para></entry> </row> <row> <entry><para>source </para></entry> - <entry><para> + <entry><para> Set source compliance level to one of [<literal>1.3 1.4 1.5</literal>] (default is 1.4). @@ -712,36 +707,36 @@ <entry><para> Set source assertion mode to one of [<literal>1.3 1.4</literal>]. - Default depends on compliance mode. + Default depends on compliance mode. </para></entry> </row> </tbody> </tgroup> - </informaltable> + </informaltable> <!-- . . . . . . . . . . . . . . . . iajc options table --> </sect2> - + <sect2 id="antTasks-nested-includes" xreflabel="nested matches"> <title>AjcTask matching parameters specified as nested elements</title> <para> - This task forms an implicit FileSet and supports all attributes of - <literal><fileset></literal> (dir becomes srcdir) as well as - the nested - <literal><include></literal>, - <literal><exclude></literal>, and + This task forms an implicit FileSet and supports all attributes of + <literal><fileset></literal> (dir becomes srcdir) as well as + the nested + <literal><include></literal>, + <literal><exclude></literal>, and <literal><patternset></literal> elements. - These can be used to specify source files. + These can be used to specify source files. However, it is better to use <literal>sourceroots</literal> - to specify source directories unless using filters to exclude + to specify source directories unless using filters to exclude some files from compilation. </para> </sect2> - + <sect2 id="antTasks-iajc-paths" xreflabel="Path"> <title>AjcTask Path-like Structures</title> <para> - Some parameters are path-like structures containing one or more + Some parameters are path-like structures containing one or more elements; these are <literal>sourceroots</literal>, <literal>argfiles</literal>, @@ -751,58 +746,51 @@ <literal>bootclasspath</literal>, <literal>forkclasspath</literal>, and <literal>aspectpath</literal>. - In all cases, these may be specified as nested elements, something + In all cases, these may be specified as nested elements, something like this: </para> - <programlisting> - <![CDATA[ - <iajc {attributes..} /> - <{name}> - <pathelement path="{first-location}"/> - <pathelement path="{second-location}"/> - ... - <{name}> + <programlisting><![CDATA[ +<iajc {attributes..} /> + <{name}> + <pathelement path="{first-location}"/> + <pathelement path="{second-location}"/> ... - </iajc> -]]> - </programlisting> + <{name}> + ... +</iajc> +]]></programlisting> <para> - As with other Path-like structures, they may be defined elsewhere + As with other Path-like structures, they may be defined elsewhere and specified using the refid attribute: </para> - <programlisting> - <![CDATA[ - <path id="aspect.path"> - <pathelement path="${home}/lib/persist.jar"/> - <pathelement path="${home}/lib/trace.jar"/> - </path> + <programlisting><![CDATA[ +<path id="aspect.path"> + <pathelement path="${home}/lib/persist.jar"/> + <pathelement path="${home}/lib/trace.jar"/> +</path> +... +<iajc {attributes..} /> + <aspectpath refid="aspect.path"/> ... - <iajc {attributes..} /> - <aspectpath refid="aspect.path"/> - ... - </iajc> -]]> - </programlisting> +</iajc> +]]></programlisting> <para> The task also supports an attribute <literal>{name}ref</literal> for each such parameter. E.g., for <literal>aspectpath</literal>: </para> - <programlisting> - <![CDATA[ - <iajc {attributes..} aspectpathref="aspect.path"/> -]]> - </programlisting> + <programlisting><![CDATA[ +<iajc {attributes..} aspectpathref="aspect.path"/> +]]></programlisting> </sect2> - + <sect2 id="antTasks-iajc-sample" xreflabel="Sample of iajc task"> <title>Sample of iajc task</title> <para> A minimal build script defines the task and runs it, specifying the sources: </para> - <programlisting> - <![CDATA[ + <programlisting><![CDATA[ <project name="simple-example" default="compile" > - <taskdef + <taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"> <classpath> <pathelement location="${home.dir}/tools/aspectj/lib/aspectjtools.jar"/> @@ -810,12 +798,11 @@ </taskdef> <target name="compile" > - <iajc sourceroots="${home.dir}/ec/project/src" - classpath="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/> + <iajc sourceroots="${home.dir}/ec/project/src" + classpath="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/> </target> </project> -]]> - </programlisting> +]]></programlisting> <para> Below is script with most everything in it. The compile process... </para> @@ -829,7 +816,7 @@ </para> </listitem> <listitem> - <para>Reads binary .class files from input jar and directory; + <para>Reads binary .class files from input jar and directory; </para> </listitem> <listitem> @@ -841,51 +828,49 @@ </para> </listitem> <listitem> - <para>Copies resources from the source directories and binary input + <para>Copies resources from the source directories and binary input jar and directories to the application jar. </para> </listitem> </orderedlist> <para> - When this target is built, the compiler will build once and then - wait for input from the user. - Messages are printed as usual. + When this target is built, the compiler will build once and then + wait for input from the user. + Messages are printed as usual. When the user has quit, then this runs the application. </para> <!-- if program changed, test in docs/test/antScriptTest --> - <programlisting> - <![CDATA[ - <target name="build-test" > - <iajc outjar="${home.dir}/output/application.jar" - sourceRootCopyFilter="**/CVS/*,**/*.java" - inpathDirCopyFilter="**/CVS/*,**/*.java,**/*.class" - incremental="true" > - <sourceroots> - <pathelement location="${home.dir}/ec/project/src"/> - <pathelement location="${home.dir}/ec/project/testsrc"/> - </sourceroots> - <inpath> - <pathelement location="${home.dir}/build/module.jar"/> - <pathelement location="${home.dir}/build/binary-input"/> - </inpath> - <aspectpath> - <pathelement location="${home.dir}/ec/int/persist.jar"/> - </aspectpath> - <classpath> - <pathelement location="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/> - </classpath> - </iajc> - - <java classname="org.smart.app.Main"> - <classpath> - <pathelement location="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/> - <pathelement location="${home.dir}/ec/int/persist.jar"/> - <pathelement location="${home.dir}/output/application.jar"/> - </classpath> - </java> - </target> -]]> - </programlisting> + <programlisting><![CDATA[ +<target name="build-test" > + <iajc outjar="${home.dir}/output/application.jar" + sourceRootCopyFilter="**/CVS/*,**/*.java" + inpathDirCopyFilter="**/CVS/*,**/*.java,**/*.class" + incremental="true" > + <sourceroots> + <pathelement location="${home.dir}/ec/project/src"/> + <pathelement location="${home.dir}/ec/project/testsrc"/> + </sourceroots> + <inpath> + <pathelement location="${home.dir}/build/module.jar"/> + <pathelement location="${home.dir}/build/binary-input"/> + </inpath> + <aspectpath> + <pathelement location="${home.dir}/ec/int/persist.jar"/> + </aspectpath> + <classpath> + <pathelement location="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/> + </classpath> + </iajc> + + <java classname="org.smart.app.Main"> + <classpath> + <pathelement location="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/> + <pathelement location="${home.dir}/ec/int/persist.jar"/> + <pathelement location="${home.dir}/output/application.jar"/> + </classpath> + </java> +</target> +]]></programlisting> <para> For an example of a build script, see <ulink url="../examples/build.xml"> @@ -902,21 +887,19 @@ is no reason to recompile sources. One way to implement that is with an explicit dependency check using the uptodate task: </para> - <programlisting> - <![CDATA[ - <target name="check.aspects.jar"> - <uptodate property="build.unnecessary" - targetfile="${aspects.module-jar}" > - <srcfiles dir="${src1}" includes="**/*.aj"/> - <srcfiles dir="${src2}/" includes="**/*.aj"/> - </uptodate> - </target> + <programlisting><![CDATA[ +<target name="check.aspects.jar"> + <uptodate property="build.unnecessary" + targetfile="${aspects.module-jar}" > + <srcfiles dir="${src1}" includes="**/*.aj"/> + <srcfiles dir="${src2}/" includes="**/*.aj"/> + </uptodate> +</target> - <target name="compile.aspects" depends="prepare,check.aspects.jar" - unless="build.unnecessary"> - <iajc ... -]]> - </programlisting> +<target name="compile.aspects" depends="prepare,check.aspects.jar" + unless="build.unnecessary"> + <iajc ... +]]></programlisting> <para> When using this technique, be careful to verify that binary input jars are themselves up-to-date after they would have been @@ -927,19 +910,19 @@ <sect2 id="programmatically-handling-compiler-messages" xreflabel="programmatically-handling-compiler-messages"> <title>Programmatically handling compiler messages</title> <para> - Users may specify a message holder to which the compiler will pass - all messages as they are generated. This will override all of the - normal message printing, but does not prevent the task from failing - if exceptions were thrown or if failonerror is true and the compiler + Users may specify a message holder to which the compiler will pass + all messages as they are generated. This will override all of the + normal message printing, but does not prevent the task from failing + if exceptions were thrown or if failonerror is true and the compiler detected errors in the sources. </para> <para> - Handling messages programmatically could be useful when using the + Handling messages programmatically could be useful when using the compiler to verify code. If aspects consist of declare [error|warning], - then the compiler can act to detect invariants in the code being - processed. For code to compare expected and actual messages, see the - AspectJ testing module (which is not included in the binary - distribution). + then the compiler can act to detect invariants in the code being + processed. For code to compare expected and actual messages, see the + AspectJ testing module (which is not included in the binary + distribution). </para> </sect2> </sect1> @@ -948,10 +931,10 @@ <sect1 id="antTasks-adapter" xreflabel="Ajc11CompilerAdapter (javac)"> <title>Ajc11CompilerAdapter (javac)</title> <para> - This CompilerAdapter can be used in javac task calls by setting the - <literal>build.compiler</literal> property. - This enables users to to easily switch between the Javac and AspectJ - compilers. However, because there are differences in source file + This CompilerAdapter can be used in javac task calls by setting the + <literal>build.compiler</literal> property. + This enables users to to easily switch between the Javac and AspectJ + compilers. However, because there are differences in source file handling between the Javac task and the ajc compiler, not all Javac task invocations can be turned over to iajc. However, ajc can compile anything that Javac can, so it should be possible for any @@ -961,24 +944,23 @@ <sect2 id="antTasks-adapter-sample" xreflabel="Sample of compiler adapter"> <title>Sample of compiler adapter</title> <para> - To build using the adapter, put the - <literal>aspectjtools.jar</literal> - on the system/ant classpath (e.g., in - <literal>${ANT_HOME}/lib</literal>) - and define the + To build using the adapter, put the + <literal>aspectjtools.jar</literal> + on the system/ant classpath (e.g., in + <literal>${ANT_HOME}/lib</literal>) + and define the <literal>build.compiler</literal> - property as the fully-qualified name of the class, - <literal>org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter</literal>. + property as the fully-qualified name of the class, + <literal>org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter</literal>. </para> <para> - The AspectJ compiler should run for any compile using the Javac task - (for options, see the Ant documentation for the Javac task). - For example, the call below passes all out-of-date source files in the - <literal>src/org/aspectj</literal> subdirectories to the + The AspectJ compiler should run for any compile using the Javac task + (for options, see the Ant documentation for the Javac task). + For example, the call below passes all out-of-date source files in the + <literal>src/org/aspectj</literal> subdirectories to the <literal>ajc</literal> command along with the destination directory: </para> - <programlisting> - <![CDATA[ + <programlisting><![CDATA[ -- command: cp aspectj1.1/lib/aspectjtools.jar ant/lib @@ -987,34 +969,31 @@ -- task invocation in the build script: <javac srcdir="src" includes="org/aspectj/**/*.java" destdir="dest" /> -]]> - </programlisting> - +]]></programlisting> + <para> To pass ajc-specific arguments, use a compilerarg entry. </para> - <programlisting> - <![CDATA[ + <programlisting><![CDATA[ -- command Ant -Dbuild.compiler=org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter -- build script - <property name="ajc" + <property name="ajc" value="org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter"/> <javac srcdir="src" includes="org/aspectj/**/*.java" destdir="dest" > <compilerarg compiler="${ajc}" line="-argfile src/args.lst"/> <javac/> -]]> - </programlisting> - <para>The Javac task does special handling of source files that +]]></programlisting> + <para>The Javac task does special handling of source files that can interfere with ajc. It removes any files that are not out-of-date - with respect to the corresponding .class files. But ajc requires all + with respect to the corresponding .class files. But ajc requires all source files, since an aspect may affect a source file that is not out of date. (For a solution to this, see the <literal>build.compiler.clean</literal> - property described below.) Conversely, developers sometimes specify a source directory + property described below.) Conversely, developers sometimes specify a source directory to javac, and let it search for files for types it cannot find. AspectJ will not do this kind of searching under the source directory (since the programmer needs to control which sources are affected). @@ -1025,46 +1004,46 @@ the source files. </para> </sect2> - + <sect2 id="antTasks-adapter-options" xreflabel="Compiler adapter compilerarg options"> <title>Compiler adapter compilerarg options</title> <para> - The adapter supports any ajc command-line option passed using compilerarg, - as well as the following options available only in AjcTask. + The adapter supports any ajc command-line option passed using compilerarg, + as well as the following options available only in AjcTask. Find more details on the following options in <xref linkend="antTasks-iajc"/>. </para> <itemizedlist> <listitem><para> - <literal>-Xmaxmem</literal>: - set maximum memory for forking (also settable in javac). + <literal>-Xmaxmem</literal>: + set maximum memory for forking (also settable in javac). </para></listitem> <listitem><para> - <literal>-Xlistfileargs</literal>: - list file arguments (also settable in javac). + <literal>-Xlistfileargs</literal>: + list file arguments (also settable in javac). </para></listitem> <listitem><para> - <literal>-Xfailonerror</literal>: + <literal>-Xfailonerror</literal>: throw BuildException on compiler error (also settable in javac). </para></listitem> <listitem><para> - <literal>-Xmessageholderclass</literal>: - specify fully-qualified name of class to use as the message holder. + <literal>-Xmessageholderclass</literal>: + specify fully-qualified name of class to use as the message holder. </para></listitem> <listitem><para> - <literal>-Xcopyinjars</literal>: + <literal>-Xcopyinjars</literal>: copy resources from any input jars to output (default behavior since 1.1.1) </para></listitem> <listitem><para> - <literal>-Xsourcerootcopyfilter {filter}</literal>: + <literal>-Xsourcerootcopyfilter {filter}</literal>: copy resources from source directories to output (minus files specified in filter) </para></listitem> <listitem><para> - <literal>-Xtagfile {file}</literal>: - use file to control incremental compilation + <literal>-Xtagfile {file}</literal>: + use file to control incremental compilation </para></listitem> <listitem><para> - <literal>-Xsrcdir {dir}</literal>: + <literal>-Xsrcdir {dir}</literal>: add to list of ajc source roots (all source files will be included). </para></listitem> </itemizedlist> @@ -1073,67 +1052,65 @@ </para> <itemizedlist> <listitem><para> - The names above may differ slightly from what you might expect + The names above may differ slightly from what you might expect from AjcTask; use these forms when specifying compilerarg. </para></listitem> </itemizedlist> <itemizedlist> <listitem><para> - By default the adapter will mimic the Javac task's copying of resource - files by specifying + By default the adapter will mimic the Javac task's copying of resource + files by specifying <literal>"**/CVS/*,**/*.java,**/*.aj"</literal> - for the sourceroot copy filter. - To change this behavior, supply your own value + for the sourceroot copy filter. + To change this behavior, supply your own value (e.g., <literal>"**/*"</literal> to copy nothing). </para></listitem> </itemizedlist> <itemizedlist> <listitem><para> Warning - define the system property - <literal>build.compiler.clean</literal> to compile all files, + <literal>build.compiler.clean</literal> to compile all files, when available. - Javac prunes the source file list of "up-to-date" source files - based on the timestamps of corresponding .class files, - and will not compile if no sources are out of date. - This is wrong for ajc which requires all the files for each compile - and which may refer indirectly to sources using argument files. + Javac prunes the source file list of "up-to-date" source files + based on the timestamps of corresponding .class files, + and will not compile if no sources are out of date. + This is wrong for ajc which requires all the files for each compile + and which may refer indirectly to sources using argument files. </para> <para> - To work around this, set the global property - <literal>build.compiler.clean</literal>. - This tells the compiler adapter to delete all .class files - in the destination directory and re-execute the javac + To work around this, set the global property + <literal>build.compiler.clean</literal>. + This tells the compiler adapter to delete all .class files + in the destination directory and re-execute the javac task so javac can recalculate the list of source files. e.g., </para> - <programlisting> - <![CDATA[ - Ant -Dbuild.compiler=org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter - -Dbuild.compiler.clean=anything ... -]]> - </programlisting> - <para> - Caveats to consider when using this global + <programlisting><![CDATA[ +Ant -Dbuild.compiler=org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter + -Dbuild.compiler.clean=anything ... +]]></programlisting> + <para> + Caveats to consider when using this global <literal>build.compiler.clean</literal> property: - </para> + </para> <orderedlist> <listitem><para> - If javac believes there are no out-of-date source files, - then the adapter is never called and cannot clean up, - and the "compile" will appear to complete successfully + If javac believes there are no out-of-date source files, + then the adapter is never called and cannot clean up, + and the "compile" will appear to complete successfully though it did nothing. </para></listitem> <listitem><para> - Cleaning will makes stepwise build processes fail if - they depend on the results of the prior compilation being + Cleaning will makes stepwise build processes fail if + they depend on the results of the prior compilation being in the same directory, since cleaning deletes all .class files. </para></listitem> <listitem><para> - This clean process only permits one compile process at a - time for each destination directory because it tracks + This clean process only permits one compile process at a + time for each destination directory because it tracks recursion by writing a tag file to the destination directory. </para></listitem> <listitem><para> - When running incrementally, the clean happens only before + When running incrementally, the clean happens only before the initial compile. </para></listitem> </orderedlist> @@ -1147,27 +1124,27 @@ <title>Ajc10 (ajc)</title> <para> This task handles the same arguments as those used by the AspectJ 1.0 task. - This should permit those with existing build scripts using the Ajc Ant + This should permit those with existing build scripts using the Ajc Ant task to continue using the same scripts when compiling with 1.1. - This will list any use of options no longer supported in 1.1 - (e.g., <literal>lenient, strict, workingdir, preprocess, usejavac</literal>,...), - and does not provide access to the new features of AspectJ 1.1. - (Developers using AspectJ 1.1 only should upgrade their scripts + This will list any use of options no longer supported in 1.1 + (e.g., <literal>lenient, strict, workingdir, preprocess, usejavac</literal>,...), + and does not provide access to the new features of AspectJ 1.1. + (Developers using AspectJ 1.1 only should upgrade their scripts to use AjcTask instead. This will not work for AspectJ 1.2 or later.) </para> - + <sect2 id="antTasks-ajc-options" xreflabel="Ajc10 (ajc) Options"> <title>Ajc10 (ajc) Options</title> <para> </para> <para> - Most attributes and nested elements are optional. - The compiler requires that the same version of + Most attributes and nested elements are optional. + The compiler requires that the same version of <literal>aspectjrt.jar</literal> be specified on the classpath, and that some sources be be specified - (using one or more of - <literal>argfiles</literal> and + (using one or more of + <literal>argfiles</literal> and <literal>srcdir</literal> (with patterns)). </para> <para>Boolean parameters default to <literal>false</literal> @@ -1190,7 +1167,7 @@ </para></entry> <entry><para> The base directory of the java files. - See + See </para></entry> </row> <row> @@ -1243,18 +1220,18 @@ <entry><para>classpath, classpathref </para></entry> <entry><para> - The classpath to use, + The classpath to use, optionally given as a reference to a classpath Path - element defined elsewhere. + element defined elsewhere. </para></entry> </row> <row> <entry><para>bootclasspath, bootclasspathref </para></entry> <entry><para> - The bootclasspath to use, + The bootclasspath to use, optionally given as a reference to a bootclasspath Path - element defined elsewhere. + element defined elsewhere. </para></entry> </row> <row> @@ -1312,9 +1289,9 @@ </tbody> </tgroup> </table> - + <table> - <title>Parameters ignored by the old ajc taskdef, + <title>Parameters ignored by the old ajc taskdef, but now supported or buggy</title> <tgroup cols="3"> <thead> @@ -1392,7 +1369,7 @@ </table> <para> - The following table shows that many of the unique parameters in + The following table shows that many of the unique parameters in AspectJ 1.0 are no longer supported. </para> <table> @@ -1425,30 +1402,30 @@ <entry><para>argfiles </para></entry> <entry><para> - A comma-delimited list of argfiles that contain a line-delimited + A comma-delimited list of argfiles that contain a line-delimited list of source file paths (absolute or relative to the argfile). </para></entry> </row> </tbody> </tgroup> </table> - - + + <sect3> <title>argfiles - argument list files</title> <para> - An argument file is a file (usually <literal>{file}.lst</literal>) - containing a list of source file paths - (absolute or relative to the argfile). - You can use it to specify all source files to be compiled, - which ajc requires to avoid searching every possible source file - in the source path when building aspects. - If you specify an argfile to the ajc task, it will not include all - files in any specified source directory (which is the default - behavior for the Javac task when no includes are specified). - Conversely, if you specify excludes, they will be removed from - the list of files compiled even if they were specified - in an argument file. + An argument file is a file (usually <literal>{file}.lst</literal>) + containing a list of source file paths + (absolute or relative to the argfile). + You can use it to specify all source files to be compiled, + which ajc requires to avoid searching every possible source file + in the source path when building aspects. + If you specify an argfile to the ajc task, it will not include all + files in any specified source directory (which is the default + behavior for the Javac task when no includes are specified). + Conversely, if you specify excludes, they will be removed from + the list of files compiled even if they were specified + in an argument file. </para> <para> The compiler also accepts arguments that are not source files, @@ -1461,40 +1438,39 @@ <sect2 id="antTasks-ajc-nested"> <title>Ajc10 parameters specified as nested elements</title> <para> - This task forms an implicit FileSet and supports all attributes of - <literal><fileset></literal> (dir becomes srcdir) as well as - the nested - <literal><include></literal>, - <literal><exclude></literal>, and - <literal><patternset></literal> elements. - These can be used to specify source files. + This task forms an implicit FileSet and supports all attributes of + <literal><fileset></literal> (dir becomes srcdir) as well as + the nested + <literal><include></literal>, + <literal><exclude></literal>, and + <literal><patternset></literal> elements. + These can be used to specify source files. </para> <para> <literal>ajc</literal>'s - <literal>srcdir</literal>, - <literal>classpath</literal>, - <literal>bootclasspath</literal>, - <literal>extdirs</literal>, and + <literal>srcdir</literal>, + <literal>classpath</literal>, + <literal>bootclasspath</literal>, + <literal>extdirs</literal>, and <literal>jvmarg</literal> - attributes are path-like structures and can also be set via nested - <literal><src></literal>, - <literal><classpath></literal>, - <literal><bootclasspath></literal>, - <literal><extdirs></literal>, and + attributes are path-like structures and can also be set via nested + <literal><src></literal>, + <literal><classpath></literal>, + <literal><bootclasspath></literal>, + <literal><extdirs></literal>, and <literal><jvmargs></literal> elements, respectively. </para> </sect2> - + <sect2 id="antTasks-ajc-sample" xreflabel="Sample of ajc task"> <title>Sample of ajc task</title> <para> - Following is a declaration for the ajc task and a sample invocation - that uses the ajc compiler to compile the files listed in + Following is a declaration for the ajc task and a sample invocation + that uses the ajc compiler to compile the files listed in <literal>default.lst</literal> into the dest dir: </para> - <programlisting> - <![CDATA[ + <programlisting><![CDATA[ <project name="example" default="compile" > <taskdef name="ajc" classname="org.aspectj.tools.ant.taskdefs.Ajc10" > @@ -1514,39 +1490,34 @@ </ajc> </target> </project> -]]> - </programlisting> +]]></programlisting> <para> This build script snippet </para> - <programlisting> - <![CDATA[ - <ajc srcdir="${src}" - destdir="${build}" - argfiles="demo.lst" - /> -]]> - </programlisting> - <para> + <programlisting><![CDATA[ +<ajc srcdir="${src}" + destdir="${build}" + argfiles="demo.lst" +/> +]]></programlisting> + <para> compiles all .java files specified in the demo.lst and stores the .class files in the ${build} directory. Unlike the Javac task, the includes attribute is empty by default, so only those files specified in demo.lst are included. - </para> - <para> + </para> + <para> This next example </para> - <programlisting> - <![CDATA[ - <ajc srcdir="${src}" - destdir="${build}" - includes="spacewar/*,coordination/*" - excludes="spacewar/Debug.java" - /> -]]> - </programlisting> - <para> - compiles .java files under the <literal>${src}</literal> directory in the - spacewar and coordination packages, and stores the .class files in the - <literal>${build}</literal> directory. - All source files under spacewar/ and coordination/ are used, except Debug.java. + <programlisting><![CDATA[ +<ajc srcdir="${src}" + destdir="${build}" + includes="spacewar/*,coordination/*" + excludes="spacewar/Debug.java" +/> +]]></programlisting> + <para> + compiles .java files under the <literal>${src}</literal> directory in the + spacewar and coordination packages, and stores the .class files in the + <literal>${build}</literal> directory. + All source files under spacewar/ and coordination/ are used, except Debug.java. </para> <para> See <ulink url="../examples/build.xml">../examples/build.xml</ulink> @@ -1561,77 +1532,77 @@ <title>Isolating problems running the Ant tasks</title> <para> - If you have problems with the tasks not solved by the documentation, - please try to see if you have the same problems when running ajc + If you have problems with the tasks not solved by the documentation, + please try to see if you have the same problems when running ajc directly on the command line. </para> <itemizedlist> <listitem><para> - If the problem occurs on the command line also, then the problem - is not in the task. + If the problem occurs on the command line also, then the problem + is not in the task. (It may be in the tools; please send bug reports.) </para></listitem> <listitem><para> - If the problem does not occur on the command line, then it may - lie in the parameters you are supplying in Ant or in the task's + If the problem does not occur on the command line, then it may + lie in the parameters you are supplying in Ant or in the task's handling of them. </para></listitem> <listitem><para> - If the build script looks correct and the problem only occurs when - building from Ant, then please send a report + If the build script looks correct and the problem only occurs when + building from Ant, then please send a report (including your build file, if possible). </para></listitem> </itemizedlist> - + <sect2 id="antTasks-knownProblems"> <title>Known issues with the Ant tasks</title> <para> - For the most up-to-date information on known problems, - see the + For the most up-to-date information on known problems, + see the <ulink url="http://bugs.eclipse.org/bugs">bug database</ulink> - for unresolved + for unresolved <ulink url="http://bugs.eclipse.org/bugs/buglist.cgi?&product=AspectJ&component=Compiler&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED"> compiler bugs - </ulink> or + </ulink> or <ulink url="http://bugs.eclipse.org/bugs/buglist.cgi?&product=AspectJ&component=Ant&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED"> taskdef bugs </ulink>. </para> <para> - When running Ant build scripts under Eclipse 2.x variants, you will get a + When running Ant build scripts under Eclipse 2.x variants, you will get a VerifyError because the Eclipse Ant support fails to isolate the Ant runtime properly. To run in this context, set up iajc to fork (and use forkclasspath). Eclipse 3.0 will fork Ant processes to avoid problems like this. </para> <para> - Memory and forking: Users email most often about the ajc task running - out of memory. - This is not a problem with the task; some compiles take a lot of + Memory and forking: Users email most often about the ajc task running + out of memory. + This is not a problem with the task; some compiles take a lot of memory, often more than similar compiles using javac. - </para> - <para> - Forking is now supported in both the - <xref linkend="antTasks-adapter"/> and - <xref linkend="antTasks-iajc"/>, - and you can set the maximum memory available. - You can also not fork and increase the memory available to Ant - (see the Ant documentation, searching for ANT_OPTS, - the variable they use in their scripts to pass VM options, + </para> + <para> + Forking is now supported in both the + <xref linkend="antTasks-adapter"/> and + <xref linkend="antTasks-iajc"/>, + and you can set the maximum memory available. + You can also not fork and increase the memory available to Ant + (see the Ant documentation, searching for ANT_OPTS, + the variable they use in their scripts to pass VM options, e.g., ANT_OPTS=-Xmx128m). </para> </sect2> <sect2 id="antTasks-feedback"> <title>Ant task questions and bugs</title> <para> - For questions, you can send email to + For questions, you can send email to <ulink url="mailto:aspectj-users@dev.eclipse.org"> - aspectj-users@dev.eclipse.org</ulink>. - (Do join the list to participate!) - We also welcome any bug reports, patches, and features; - you can submit them to the bug database at + aspectj-users@dev.eclipse.org</ulink>. + (Do join the list to participate!) + We also welcome any bug reports, patches, and features; + you can submit them to the bug database at <ulink url="http://bugs.eclipse.org/bugs"> http://bugs.eclipse.org/bugs</ulink> - using the AspectJ product and Ant component. + using the AspectJ product and Ant component. </para> </sect2> </sect1> diff --git a/docs/devGuideDB/aspectj-mode.xml b/docs/devGuideDB/aspectj-mode.xml index b54837964..e2ee862db 100644 --- a/docs/devGuideDB/aspectj-mode.xml +++ b/docs/devGuideDB/aspectj-mode.xml @@ -118,7 +118,7 @@ <entry>M-x aspectj-jump-menu (C-x C-j)</entry> <entry> Display popup menu of advisers, advisees, and inter-type declarations. - Navigate to item by selecting with mouse + Navigate to item by selecting with mouse (see <link linkend="aspectjmodescreenshot2">figure</link> below). </entry> </row> @@ -208,9 +208,10 @@ The files in this package need to be in the load-path and ``required''. For example, for the 1.0 release: <programlisting> - ;; I keep my emacs packages in C:/Emacs - (setq load-path (cons "C:/Emacs/aspectj-emacsMode-1.0" load-path)) - (require 'aspectj-mode)</programlisting> +;; I keep my emacs packages in C:/Emacs +(setq load-path (cons "C:/Emacs/aspectj-emacsMode-1.0" load-path)) +(require 'aspectj-mode) + </programlisting> </para> </listitem> @@ -329,17 +330,17 @@ Error in init file: File error: "Cannot open load file", "aspectj-mode" <listitem> <para><emphasis>Symptom</emphasis>: When trying to get a jump menu, - I get the message "No crosscut elements at point" even though + I get the message "No crosscut elements at point" even though there is a [list] on the same line. </para> <para>The caret (point) is probably on or after the list. - To see the crosscut elements you need to hit the jump menu - on the same line that the annotated elements appear as a list - of items surrounded by '[' and ']' on the same line as the - affected declaration. If the caret is on the same line as the - elements and before the list (i.e. not at the end of the - list of elements) the jump menu should work. + To see the crosscut elements you need to hit the jump menu + on the same line that the annotated elements appear as a list + of items surrounded by '[' and ']' on the same line as the + affected declaration. If the caret is on the same line as the + elements and before the list (i.e. not at the end of the + list of elements) the jump menu should work. </para> </listitem> </itemizedlist> diff --git a/docs/devGuideDB/ltw.xml b/docs/devGuideDB/ltw.xml index bc5aac769..969070f44 100644 --- a/docs/devGuideDB/ltw.xml +++ b/docs/devGuideDB/ltw.xml @@ -146,54 +146,53 @@ may define abstract pointcuts (but not abstract methods). The following example shows a simple aop.xml file: </para> <programlisting><![CDATA[ - <aspectj> - - <aspects> - <!-- declare two existing aspects to the weaver --> - <aspect name="com.MyAspect"/> - <aspect name="com.MyAspect.Inner"/> - - <!-- define a concrete aspect inline --> - <concrete-aspect name="com.xyz.tracing.MyTracing" - extends="tracing.AbstractTracing" - precedence="com.xyz.first, *"> - <pointcut name="tracingScope" expression="within(org.maw.*)"/> - </concrete-aspect> - - <!-- Of the set of aspects declared to the weaver - use aspects matching the type pattern "com..*" for weaving. --> - <include within="com..*"/> - - <!-- Of the set of aspects declared to the weaver - do not use any aspects with the @CoolAspect annotation for weaving --> - <exclude within="@CoolAspect *"/> - - </aspects> - - <weaver options="-verbose"> - <!-- Weave types that are within the javax.* or org.aspectj.* - packages. Also weave all types in the foo package that do - not have the @NoWeave annotation. --> - <include within="javax.*"/> - <include within="org.aspectj.*"/> - <include within="(!@NoWeave foo.*) AND foo.*"/> - - <!-- Do not weave types within the "bar" pakage --> - <exclude within="bar.*"/> - - <!-- Dump all types within the "com.foo.bar" package - to the "./_ajdump" folder on disk (for diagnostic purposes) --> - <dump within="com.foo.bar.*"/> - - <!-- Dump all types within the "com.foo.bar" package and sub-packages, - both before are after they are woven, - which can be used for byte-code generated at runtime - <dump within="com.foo.bar..*" beforeandafter="true"/> - </weaver> - - </aspectj> - - ]]></programlisting> +<aspectj> + + <aspects> + <!-- declare two existing aspects to the weaver --> + <aspect name="com.MyAspect"/> + <aspect name="com.MyAspect.Inner"/> + + <!-- define a concrete aspect inline --> + <concrete-aspect name="com.xyz.tracing.MyTracing" + extends="tracing.AbstractTracing" + precedence="com.xyz.first, *"> + <pointcut name="tracingScope" expression="within(org.maw.*)"/> + </concrete-aspect> + + <!-- Of the set of aspects declared to the weaver + use aspects matching the type pattern "com..*" for weaving. --> + <include within="com..*"/> + + <!-- Of the set of aspects declared to the weaver + do not use any aspects with the @CoolAspect annotation for weaving --> + <exclude within="@CoolAspect *"/> + + </aspects> + + <weaver options="-verbose"> + <!-- Weave types that are within the javax.* or org.aspectj.* + packages. Also weave all types in the foo package that do + not have the @NoWeave annotation. --> + <include within="javax.*"/> + <include within="org.aspectj.*"/> + <include within="(!@NoWeave foo.*) AND foo.*"/> + + <!-- Do not weave types within the "bar" pakage --> + <exclude within="bar.*"/> + + <!-- Dump all types within the "com.foo.bar" package + to the "./_ajdump" folder on disk (for diagnostic purposes) --> + <dump within="com.foo.bar.*"/> + + <!-- Dump all types within the "com.foo.bar" package and sub-packages, + both before are after they are woven, + which can be used for byte-code generated at runtime + <dump within="com.foo.bar..*" beforeandafter="true"/> + </weaver> + +</aspectj> +]]></programlisting> <para> The DTD defining the format of this file is available here: @@ -301,37 +300,37 @@ Consider the following: </para> <programlisting><![CDATA[ - package mypack; +package mypack; - @Aspect - public abstract class AbstractAspect { +@Aspect +public abstract class AbstractAspect { - // abstract pointcut: no expression is defined - @Pointcut - abstract void scope(); + // abstract pointcut: no expression is defined + @Pointcut + abstract void scope(); - @Before("scope() && execution(* *..doSome(..))") - public void before(JoinPoint jp) { - .... - } - } - ]]></programlisting> + @Before("scope() && execution(* *..doSome(..))") + public void before(JoinPoint jp) { + .... + } +} +]]></programlisting> <para> This aspect is equivalent to the following in code style: </para> <programlisting><![CDATA[ - package mypack; +package mypack; - public abstract aspect AbstractAspect { +public abstract aspect AbstractAspect { - // abstract pointcut: no expression is defined - abstract pointcut scope(); + // abstract pointcut: no expression is defined + abstract pointcut scope(); - before() : scope() && execution(* *..doSome(..)) { - .... - } - } - ]]></programlisting> + before() : scope() && execution(* *..doSome(..)) { + .... + } +} +]]></programlisting> <para> This aspect (in either style) can be made concrete using <literal>META-INF/aop.xml</literal>. It defines the abstract pointcut <literal>scope()</literal>. When using this mechanism the @@ -361,14 +360,14 @@ The following XML definition shows a valid concrete sub-aspect for the abstract aspects above: </para> <programlisting><![CDATA[ - <aspectj> - <aspects> - <concrete-aspect name="mypack.__My__AbstractAspect" extends="mypack.AbstractAspect"> - <pointcut name="scope" expression="within(yourpackage..*)"/> - </concrete-aspect> - <aspects> - </aspectj> - ]]></programlisting> +<aspectj> + <aspects> + <concrete-aspect name="mypack.__My__AbstractAspect" extends="mypack.AbstractAspect"> + <pointcut name="scope" expression="within(yourpackage..*)"/> + </concrete-aspect> + <aspects> +</aspectj> +]]></programlisting> <para> It is important to remember that the <literal>name</literal> attribute in the <literal>concrete-aspect</literal> directive defines the fully qualified name that will be given to the @@ -381,12 +380,12 @@ as in: </para> <programlisting><![CDATA[ - // exception handling omitted - Class myConcreteAspectClass = Class.forName("mypack.__My__AbstractAspect"); +// exception handling omitted +Class myConcreteAspectClass = Class.forName("mypack.__My__AbstractAspect"); - // here we are using a singleton aspect - AbstractAspect concreteInstance = Aspects.aspectOf(myConcreteAspectClass); - ]]></programlisting> +// here we are using a singleton aspect +AbstractAspect concreteInstance = Aspects.aspectOf(myConcreteAspectClass); +]]></programlisting> </sect2> <sect2 id="concrete-aspect-precedence" xreflabel="concrete-aspect-precedence"> @@ -406,13 +405,13 @@ Consider the following: </para> <programlisting><![CDATA[ - <aspectj> - <aspects> - <concrete-aspect name="mypack.__MyDeclarePrecedence" - precedence="*..*Security*, Logging+, *"/> - </aspects> - </aspectj> - ]]></programlisting> +<aspectj> + <aspects> + <concrete-aspect name="mypack.__MyDeclarePrecedence" + precedence="*..*Security*, Logging+, *"/> + </aspects> +</aspectj> +]]></programlisting> <para> This deployment time definitions is only declaring a precedence rule. You have to remember that the <literal>name</literal> attribute must be a valid fully qualified class name @@ -430,13 +429,13 @@ search path. Everything that can be configured through XML can be configured using a Properties file, with the exception of declarative concrete aspects. For example: </para> <programlisting><![CDATA[ - aspects.names=com.MyAspect,com.MyAspect.Inner - aspects.include=com..* - aspects.exclude=@CoolAspect +aspects.names=com.MyAspect,com.MyAspect.Inner +aspects.include=com..* +aspects.exclude=@CoolAspect - weaver.options=-verbose - weaver.include=javax.* OR org.aspectj.* - ]]></programlisting> +weaver.options=-verbose +weaver.include=javax.* OR org.aspectj.* +]]></programlisting> </sect2> --> @@ -594,8 +593,8 @@ <para> When using Java 5 the JVMTI agent can be used by starting the JVM with the following option (adapt according to the path to aspectjweaver.jar): </para> <programlisting><![CDATA[ - -javaagent:pathto/aspectjweaver.jar - ]]></programlisting> +-javaagent:pathto/aspectjweaver.jar +]]></programlisting> </sect2> <sect2 id="jrockit" xreflabel="jrockit"> <title>JRockit with Java 1.3/1.4 (use JVMTI on Java 5)</title> |