Home

Documentation

* Programming Guide * CJDT User Guide * Publications * Tutorial * Language Spec.

Examples

Downloads

Source Code

FAQ

Community Info

About Us

 

 
Search:
 
ST Logo
TUD Logo
< Back

Release Notes v0.8.0

What's new?

Pointcuts

Caesar class names now can be used in poincuts. In the previous version of CaesarJ only names of Java classes could be used in poincuts. The names of Caesar classes (classes, declared with cclass) couldn't be directly used in poincuts and had to be translated by developer to underlying Java class names. Since version 0.8.0 this translation is done automatically by the compiler.

This change is relevant to get, set and within pointcuts in general, as well as to execution and call poincuts specifically for constructors and static method calls. For example, following code will be woven correctly now:
 
public cclass ClassA {
   public int f;
   public ClassA() {
      f = 0;
   }	
   public void m() {
      f = 5;
   }
   public void n() {
      m();
   }
   public static void x() { }
}

public cclass Test {
   public void test() {
      ClassA a = new ClassA();
      a.m();
      int f = a.f;
      a.n();
      ClassA.x();
   }	
}

public deployed cclass AspectA {
   /* constructor call */
   after() : call(ClassA.new()) {
      System.out.println("constructor call");
   }
   /* constructor execution */
   after() : execution(ClassA.new()) {
      System.out.println("constructor execution");
   }
   /* field access */
   after() : get(* ClassA.*) {
      System.out.println("field access");
   }
   after() : set(* ClassA.*) {
      System.out.println("field change");
   }
   /* calls within a class */
   after() : call(* *.*(..)) && within(ClassA) {
      System.out.println("calls within ClassA");
   }
   /* static calls */
   after() : call(static * ClassA.*(..))  {
      System.out.println("static call");
   }	
}

Execution of Test.test() will produce following output:
 
field change
constructor execution
constructor call
field change
field access
field change
calls within ClassA
static call

Note: There some semantic differences w.r.t. AspectJ poincut language:

  1. execution and call poincuts on constructors are matched according the same rules as methods. Since CaesarJ supports polymorphic class instantiation, constructors are polymorphic too and can be overriden in subclasses. Therefore, execution(ClassA.new()) will match not only the contructor of ClassA, but also all overriding constructors.

  2. initialization and preinitialization pointcuts do not distinguish between different constructors and, therefore, should not specify constructor parameters, e.g. initialization(public A.new()) and preinitialization(public A.new()). These poincuts will match A a = new A() as well as A a = new A("string").

  3. There are certain differences related with within matching. Consider the following hierarchy:
 
        class ClsA {
           public void run() {}
           class InA {
              public void run() {}
           }
        }
        class ClsB extends ClsA {
           /*
           class InA {
              public void run() {}
           }
           */
        }

In AspectJ, a pointcut within(ClsA) matches code inside ClsA, ClsA.InA and ClsB.InA. Note that ClsB.InA is commented. That means when ClsB.InA is called, the code used comes from ClsA and matches. If we uncomment this new code, then ClsB.InA is inside ClsB and it does NOT match. A pointcut within(ClsA+) will match everything (ClsA, ClsA.InA, ClsB, ClsB.InA), despite of the comments.

In Caesar, the semantics are almost the same. The only difference is that nested classes are considered virtual classes and are copied to subtypes. So, the pointcut within(ClsA+) works exactly the same. But within(ClsA) will never match subtypes, even if they do not declare it (in our example, it would not match ClsB.InA, even if commented).

Removed Limitations

  • Anonymous classes can be used within Caesar classes.

Important Bug Fixes

  • Bugs related with linearization of complicated inheritance hierarchies fixed.
  • Bugs related with preparation for remoting and remote deployment are fixed.

CJDT Plugin for Eclipse

  • Plugin is ported to Eclipse 3.1
  • Debugging support is stabilized

Known limitations

  • There are certain visibility restrictions:
    • package visibility is not available.
    • cclass'es must be declared as public.

  • public fields can be only written by the owner object, access from outside is read-only

  • Arrays of cclass-es are not allowed.

  • It is not possible for Caesar classes to inherit from pure Java classes. Nevertheless Caesar classes can implement Java interfaces.

  • Default constructor is always available. Classes inherit constructors from they parents. Inherited constructors can be overridden, but not hidden.

  • if pointcuts are not available.