From 5c79253a191046d074d9c893a1e7b50890f98890 Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 26 Feb 2008 16:36:22 +0000 Subject: [PATCH] m2 info! --- docs/dist/doc/README-160.html | 124 +++++++++++++++++++++++++++++++++- 1 file changed, 123 insertions(+), 1 deletion(-) diff --git a/docs/dist/doc/README-160.html b/docs/dist/doc/README-160.html index ffb72f3db..8061d60a4 100644 --- a/docs/dist/doc/README-160.html +++ b/docs/dist/doc/README-160.html @@ -20,7 +20,129 @@ All rights reserved.

AspectJ v1.6.0 Readme

-

AspectJ v1.6.0M1 - 16 Jan 2008

+

AspectJ v1.6.0M2 - 26 Feb 2008

+

This milestone fixes a number of issues raised against M1 and earlier versions of AspectJ. The full list of fixes +is accessible here: +1.6.0m2 fixes. + +

1.6.0m2 includes two new features: +

+

+

Parameter Annotation Matching

+

Parameter matching is possible for constructors and methods. The use +of parentheses around the parameter types in a method signature +determine whether the annotations relate to the type of the parameter +or the parameter itself. + +


+execution(* *(@A *));
+
+

- Execution of a method/ctor whose first parameter is of a type +annotated with @A. + +


+execution(* *(@A (*)));
+
+

- Execution of a method/ctor whose first parameter is annotated with @A + +


+execution(* *(@A (@B *)))
+
+

- Execution of a method/ctor whose first parameter is annotated with +@A and is of a type annotated with @B. + +Example: +


+------ Start of Test.java -----
+@interface A {}
+@interface B {}
+
+class C {
+ public void foo(@A String s) {}
+ public void goo(@A @B String s) {}
+}
+
+aspect X {
+ before(): execution(* *(@A (*))) {}
+ before(): execution(* *(@B (*))) {}
+}
+------ End of Test.java -----
+$ ajc -showWeaveInfo -1.6 Test.java
+Join point 'method-execution(void C.foo(java.lang.String))' in Type 'C' (A.java:5) advised by before advice from 'X' (A.java:10)
+
+Join point 'method-execution(void C.goo(java.lang.String))' in Type 'C' (A.java:6) advised by before advice from 'X' (A.java:11)
+
+Join point 'method-execution(void C.goo(java.lang.String))' in Type 'C' (A.java:6) advised by before advice from 'X' (A.java:10)
+
+

The first piece of advice matched both methods. The second only matched goo(). +

+

Annotation Value Matching

+ +

This allows static matching of the values of an annotation - if the matching is done statically at weave time, it is possible +to avoid some of the reflection that is currently required within the advice (in some cases). A typical use case is tracing where +the trace level is defined by an annotation but may be switched OFF for a method if the annotation has a particular value. Perhaps +tracing has been turned on at the type level and a few critical methods should not get traced. Here is some code showing the +use case: +

+ +


+enum TraceLevel { NONE, LEVEL1, LEVEL2, LEVEL3 }
+
+@interface Trace {
+  TraceLevel value() default TraceLevel.LEVEL1;
+}
+  
+aspect X {
+  // Advise all methods marked @Trace except those with a tracelevel of none
+  before(): execution(@Trace !@Trace(TraceLevel.NONE) * *(..)) {
+    System.err.println("tracing "+thisJoinPoint);
+  }
+}
+
+public class ExampleOne {
+
+  public static void main(String[] args) {
+    ExampleOne eOne = new ExampleOne();
+    eOne.m001();
+    eOne.m002();
+    eOne.m003();
+    eOne.m004();
+    eOne.m005();
+    eOne.m006();
+    eOne.m007();
+  }
+
+  @Trace(TraceLevel.NONE)
+  public void m001() {}
+
+  @Trace(TraceLevel.LEVEL2)
+  public void m002() {} // gets advised
+
+  @Trace(TraceLevel.LEVEL3)
+  public void m003() {} // gets advised
+
+  @Trace(TraceLevel.NONE)
+  public void m004() {}
+
+  @Trace(TraceLevel.LEVEL2)
+  public void m005() {} // gets advised
+
+  @Trace(TraceLevel.NONE)
+  public void m006() {}
+
+  @Trace
+  public void m007() {} // gets advised
+
+}
+
+Matching is currently allowed on all annotation value types *except* class and array. Also it is +not currently supported for parameter annotation values. + +
+

AspectJ v1.6.0M1 - 16 Jan 2008

This is the first milestone release of AspectJ 6. AspectJ 6 is a Java 6 compiler, the underlying Eclipse JDT compiler version upon which it is based is 785_R33x - a recent 3.3 version.

The compiler had changed a lot since version 574_R31x when we last merged! -- 2.39.5