< Back
Release Notes v0.8.5
What's new?
Super References in Pointcuts
The language allows super references to pointcuts, e.g.
public cclass AspectA {
pointcut pcutA() : call (void ClsC.m(..));
pointcut pcutB(int a) : pcutA() && args(a);
after(int a) : pcutB(a) {
System.out.println(":after:" + a);
}
}
public cclass AspectB extends AspectA {
pointcut pcutA() : super.pcutA() || call (void ClsC.n(..));
}
public cclass ClsC {
public void m(int a) { }
public void n(int a) { }
}
Note, that pointcut super references are static and are not subject of mixin linearization.
Per This Deployment
Aspects can be deployed on individual objects and intercept only the joinpoints in their execution context. The compiler knows that an aspect should be prepared for per-this deployment if it implements
PerThisDeployable
interface. Such an aspect can be nevertheless deployed using other deployment strategies too.
An aspect is deployed on an object using the runtime library method
DeploySupport.deployOnObject
. They can be undeployed by calling
DeploySupport.undeployFromObject
Example:
public class Test {
public void test() {
Model m1 = new Model();
Model m2 = new Model();
View v = new View();
DeploySupport.deployOnObject(v, m2);
m2.setA(2);
m1.setA(3);
m2.setA(4);
DeploySupport.undeployFromObject(v, m2);
}
}
public class Model {
int a = 0;
public int getA() {
return a;
}
public void setA(int a) {
this.a = a;
}
public String toString() {
return ":model-" + a;
}
}
public cclass View implements PerThisDeployable {
before(Model m): execution(* Model.set*(..)) && this(m) {
System.out.println(m.toString());
}
after(Model m): execution(* Model.set*(..)) && this(m) {
System.out.println(m.toString());
}
}
Optimizations
The amount of generated implicit virtual classes and their mixin copies are reduced. Abstract classes that do not have concrete subclasses are not generated. The mixin linearization algorithm is modified so that more mixin chains can be reused.
Important Bug Fixes
- Various bugs related with resolving of class names in pointcuts and advice are solved
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.
- Java 5 features (generics, etc.) are not availabe