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:

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.

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").

There are certain differences related with within matching. Consider the following hierarchy:

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).