I get a VerifyError when trying to run the compiled output of this
program using the thisJoinPointOnlyIdentity flag:
import org.aspectj.lang.*;
public class A {
public static void main(String args[]) {
f();
}
static void f() {
System.out.println("f");
g();
}
static void g() {
System.out.println("g");
}
}
aspect X {
pointcut enclosingExec(Object jp) : //Runs properly if type is
JoinPoint, VerifyError if Object
cflowbelow(execution(* f())) && let(jp,thisJoinPoint);
tracematch(Object jp) { //same here
sym f1 before : execution(* f()) && let(jp, thisJoinPoint);
sym f2 after : execution(* f()) && let(jp, thisJoinPoint);
sym g after : call(* g()) && enclosingExec(jp);
f1 g f2{
System.out.println("f g match");
}
}
}
It doesn't come up when I enable doValidate, it only comes up when I try
to run the program. The program compiles properly if the
thisJoinPointOnlyIdentify flag is not enabled.
Neil
Ganesh Sittampalam wrote:
> Hi all,
>
> I've just checked in a debug flag "thisJoinPointOnlyIdentity". Running
> with this will have the effect of making the "thisJoinPoint" variable
> be of type Object, with a new one created at each join point. If your
> code still type checks, then probably all you are doing with
> thisJoinPoint is comparing it with other ones for identity, and
> obviously the construction process will be rather a lot cheaper!
>
> Of course, your code might really only be comparing them for identity,
> but not type check because you have explicitly stored it into a
> variable of the wrong type. You can either change your code to use
> variables of type Object instead of type org.aspectj.lang.JoinPoint,
> or ask me to switch to my alternative implementation, which involved a
> dummy implementation of the org.aspectj.lang.JoinPoint interface.
>
> [For the benefit of anyone who wasn't following the discussions about
> this, the idea is to see whether it's worth making a proper analysis
> that can do this kind of thing automatically and safely. The original
> plan was to make a new special variable in EAJ, called
> thisJoinPointIdentity, but I gave up on this when I realised how much
> boilerplate it would need in the front-end.]
>
> Cheers,
>
> Ganesh
>
>
Received on Fri Mar 03 19:33:17 2006
This archive was generated by hypermail 2.1.8 : Tue Mar 06 2007 - 16:13:27 GMT