[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-dev] -XlazyTjp and xlint-warning
|
Oliver,
The answer is a quite subtle and there still might be a bug here. AspectJ
cannot use -XlazyTjp for around advice so you must attempt to use a pattern
for which it can be exploited then you will get the warning. Changing your
aspect:
public aspect TraceAspect {
public static boolean enabled = true;
pointcut toBeTraced() : execution(* *(..)) && !within(TraceAspect);
before () : toBeTraced() && if(enabled) {
Object[] args = thisJoinPoint.getArgs();
System.out.println(thisJoinPoint + ", arg's: " + args.length);
}
Object around() : toBeTraced() && if(enabled) {
// Object[] args = thisJoinPoint.getArgs();
// System.out.println(thisJoinPoint + ", arg's: " + args.length);
return proceed();
}
}
will cause a warning. However if you restore the use of "thisJoinPoint" in
the around advice the warning will go away. I think _this_ is a bug because
if you code a pattern that can exploit -XlazyTjp and it cannot be used for
whatever reason you should be warned.
Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester, SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/
"Oli B." <boehm@xxxxxxxxxx>@eclipse.org on 24/03/2005 22:09:33
Please respond to aspectj-dev@xxxxxxxxxxx
Sent by: aspectj-dev-admin@xxxxxxxxxxx
To: aspectj-dev@xxxxxxxxxxx
cc:
Subject: [aspectj-dev] -XlazyTjp and xlint-warning
Hello,
for the Option -XlazyTjp I used the Tracing example from the
README-12.html (a little bit modified):
public aspect TraceAspect {
public static boolean enabled = false;
pointcut toBeTraced() : execution(* *(..)) && !within(TraceAspect);
Object around() : toBeTraced() && if(enabled) {
Object[] args = thisJoinPoint.getArgs();
System.out.println(thisJoinPoint + ", arg's: " + args.length);
return proceed();
}
}
from the README: "The optimization is disabled at join points advised by
around advice, and an Xlint warning will be displayed in these cases."
But when I compile it (ajc -XlazyTjp -Xlint:warning -inpath src -d
classes src/lazy/tjp/*) I expect to get a warning -- but no warning
appears (AspectJ 1.5.0 M1).
regards
Oliver
--
Oliver Böhm
http://www.javatux.de
_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev