From 281aa146422b25e52315a2e908b37a3f9a8f3144 Mon Sep 17 00:00:00 2001 From: wisberg Date: Wed, 4 Jun 2003 10:32:43 +0000 Subject: [PATCH] 1.1 updates --- docs/faq/faq.xml | 156 +++++++++++++++++++++++++++++++---------------- 1 file changed, 104 insertions(+), 52 deletions(-) diff --git a/docs/faq/faq.xml b/docs/faq/faq.xml index 9ac2191f4..4e1cb8cbc 100644 --- a/docs/faq/faq.xml +++ b/docs/faq/faq.xml @@ -23,7 +23,7 @@ 2003 Contributors. All rights reserved. - Last updated April 9, 2003. + Last updated June 4, 2003. @@ -209,12 +209,10 @@ aspect-oriented programming language and tool set. - The latest release is 1.0.6 - which can be downloaded from the 1.0 AspectJ - download page. - To download the current source tree from the - AspectJ project, - see + The latest release is 1.1 + which can be downloaded from the + AspectJ project page, + including sources as described . Development is focused on supporting applications, improving quality and performance, @@ -239,8 +237,8 @@ Java platform (jdk1.1 and later). When running, your program classes must be able to reach classes in the small (< 100K) runtime library (aspectjrt.jar) from the distribution. - The tools themselves require Java 2 (jdk 1.2) or later to run, - but the compiler can be set up to target any 1.1-compliant + The tools themselves require J2SE 1.3 or later to run, + but the compiler can produce classes for any 1.1-compliant version of the Java platform. @@ -1504,6 +1502,12 @@ aspect PublicErrorLogging { ajc @sources.lst ajc -argfile sources.lst + + Another way in AspectJ 1.1 is to use the + -sourceroots options, which reads all + source files in a given set of diretories: + + ajc -sourceroots "src;testsrc" For more information, see the ajc tool @@ -1527,7 +1531,8 @@ ajc -argfile sources.lst for your platform. The compiler's performance is dependent on the performance of the JVM it is running on, so the faster a JVM you can find to run it on, the shorter your compile times will be. At a - minimum you need to use a Java 2 or later JVM to run the compiler. + minimum you need to use a Java 2 or later JVM to run the compiler + (J2SE 1.3 for AspectJ 1.1). We realize that this constraint can be a problem for users who don't currently have a Java 2 JVM available. We're sorry for the inconvenience, but we had to make the hard decision that the @@ -1670,8 +1675,8 @@ ajc -bootclasspath c:\jdk1.2\jre\lib\rt.jar \ - - The PARSER for ajc is written by hand. This choice was made with full + In AspectJ 1.0, + the PARSER for ajc is written by hand. This choice was made with full awareness of the generator tools out there. (Jim had for example used the excellent javacc tool for building the parser for JPython (now Jython)). One of the reasons that AspectJ uses a hand-written parser is that using @@ -1736,6 +1741,12 @@ ajc -bootclasspath c:\jdk1.2\jre\lib\rt.jar \ like "*1.f(..)" which no one would ever write, but which must be supported for a consistent language. + + In AspectJ 1.1, the parser was written as it is for the underlying + Eclipse compiler, + with some hand-coding of the sort that avoids adding keywords to + the language. + @@ -2007,10 +2018,11 @@ import org.aspectj.lang.*; import org.aspectj.lang.reflect.*; import java.io.*; -public abstract aspect TraceJoinPoints dominates * { +public abstract aspect TraceJoinPoints { protected abstract pointcut entry(); protected pointcut exit(): call(* java..*.*(..)); + declare precedence : TraceJoinPoints, *; final pointcut start(): entry() && !cflowbelow(entry()); final pointcut trace(): @@ -2109,6 +2121,11 @@ public abstract aspect TraceJoinPoints dominates * { ]]> + Note that if you are using AspectJ 1.0, + the line starting with declare precedence + would be removed, and the aspect declaration would look like + aspect TraceMyJoinPoints dominates *. + @@ -2126,7 +2143,7 @@ public abstract aspect TraceJoinPoints dominates * { The main difference is that a call join point happens outside of - the object (for non-static methods) or class (for static methods + the target object (for non-static methods) or class (for static methods and constructors), and that an execution join point happens inside the object or class. This means that the within and withincode pointcuts pick them out @@ -2190,9 +2207,12 @@ public abstract aspect TraceJoinPoints dominates * { execution. - In most cases you should use the call() + Because of differences in the way AspectJ 1.0 and 1.1 + are implemented, in 1.0 + you should use the call() pointcut designator unless you have a good reason to use - execution() + execution(); in AspectJ 1.1, the + reverse is true. @@ -2282,6 +2302,12 @@ class Test extends Super implements I { Test() {} } +]]> + + For a program compiled with AspectJ 1.0, + the result is this: + + @@ -2370,7 +2396,7 @@ class Test extends Super implements I { - This reflects both a conceptual error and a programming mistake. + This usually reflects both a conceptual error and a programming mistake. Most likely you want to do something like "run the advice for all public and private calls," and the code looks something like this: @@ -2378,7 +2404,7 @@ class Test extends Super implements I { within(com.xerox.printing..*) && call(public * *(..)) && call(private * *(..)) - A pointcut picks out join points; it is evaluated at each join point. + But a pointcut is evaluated at *each* join point. The expression above would never pick out any call join point, because no method signature has both public and private access. In a pointcut, pc1() && pc2() means both @@ -2406,6 +2432,12 @@ class Test extends Super implements I { This makes it impossible to refer to static members using runtime information. + However, AspectJ can determine the class for something + in the join point context, which you can use as a per-class key. + Then you can actually declare an instance field to contain + the per-class value (see the next question). This comes at + the cost of an extra reference, but the field can be final. + @@ -2656,6 +2688,10 @@ aspect A { after advice, like a finally clause, runs even after exceptions are thrown. You can fix this by following two practices: + In AspectJ 1.1, the String concatenation operator (+) is + advised in its StringBuffer form, so if your advise uses + String + in a way that is picked out by your pointcut, + you will get infinite recursion. (1) Use after returning to advise normal completions or after throwing to advise abrupt completions. @@ -2744,7 +2780,7 @@ aspect A { -Xmx256M. When running under Ant, give Ant more memory or - use the fork fork option together with + use the fork option together with the Xmaxmem option. When running under an IDE, look to the documentation @@ -2763,8 +2799,9 @@ aspect A { ajc 1.0 does not currently support incremental - compilation, but the 1.1 release does. It may still recompile - files that have not changed, if they are affected by aspects + compilation, but the 1.1 release does when passed the + -incremental option. It may still recompile + files that have not changed, if they could be affected by aspects in particular ways, but the files compiled should be fewer and result in faster compiles. @@ -3081,7 +3118,12 @@ vmparam -Xmx384m - + The bugs affecting the semantics of the language + are marked with the "info" keyword. Find them with + the query + + http://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&keywords=info + @@ -3444,23 +3486,23 @@ vmparam -Xmx384m - For any builds: build, lib - - For the documentation: docs - - For the compiler: bridge, util, testing-util, + For any builds: build, lib + + For the documentation: docs + + For the compiler: bridge, util, testing-util, weaver, asm, org.eclipse.jdt.core, org.aspectj.ajdt.core, and runtime. - - For ajbrowser: the compiler modules, plus + + For ajbrowser: the compiler modules, plus ajbrowser, taskdefs, and ajde. - - For the test harness: the ajbrowser modules, plus + + For the test harness: the ajbrowser modules, plus testing, testing-client, and testing-drivers. - - To run the test suite: the test harness modules, plus + + To run the test suite: the test harness modules, plus tests. - + @@ -3484,30 +3526,32 @@ vmparam -Xmx384m (i.e., in org.aspectj/modules/build/...). Most pertinant: - ../build/readme-build-and-test-aspectj.html + + ../build/readme-build-and-test-aspectj.html describes how to build the AspectJ distribution in Eclipse and in Ant. - - ../build/readme-docs-module.html + + + ../build/readme-docs-module.html describes the AspectJ documentation sources and how to build the documentation using Ant. - - ../build/readme-tests-module.html + + ../build/readme-tests-module.html describes the all the tests in the tests module. - - ../build/readme-writing-compiler-tests.html + + ../build/readme-writing-compiler-tests.html describes how to write compiler tests that can be run by the AspectJ test harness. - - ../build/readme-testing-drivers-module.html + + ../build/readme-testing-drivers-module.html describes the test harness used to run the compiler tests in the tests module. - - ../build/readme-testing-drivers-module.html + + ../build/readme-testing-drivers-module.html describes the test harness used to run the compiler tests in the testing module. - + @@ -3920,6 +3964,8 @@ vmparam -Xmx384m The FAQ has been updated to reflect the move to eclipse.org and changes in the 1.1 version. + The most recent changes corrected 1.0-specific statements + in many entries. Entries changed since the earlier March 3, 2003 version: @@ -4052,10 +4098,11 @@ vmparam -Xmx384m - The AspectJ team aims to keep the implementation up-to-date - and bug-free, but to limit language changes to those that - are carefully considered, compelling, and backwards-compatible, - and to deliver those language changes only in significant releases (1.0, 1.1). + The AspectJ team aims to keep the implementation bug-free and + up-to-date with the Java language, + to limit AspectJ language changes to those that + are carefully considered, compelling, and backwards-compatible, + and to deliver those language changes only in significant releases (1.0, 1.1). @@ -4066,6 +4113,10 @@ vmparam -Xmx384m Description + AspectJ 1.1 + A few language changes and clarifications; + bytecode weaving and incremental compilation. + AspectJ 1.0 Many language changes, fixes, cleanup and clarifications, some significant. @@ -4161,8 +4212,9 @@ vmparam -Xmx384m and a small number of language changes. - 2.0 - New, dynamic crosscuts (bytecode-only) + 1.2 + language upgrades to increase reusability + of aspects, compliance with any released J2SE 1.5 -- 2.39.5