It is my understanding that the use of JoinPoint is a reflective operation. Therefore, I have the choice between two supposed inefficient mechanisms of obtaining the type of class and line number located at the join point, reflective JoinPoint.getSourceLocation() vs generating an exception and interrogating the stack: [EMAIL PROTECTED]("call (net.kedges.Foo+.new(..))") public void fooCreatedHere(JoinPoint thisJoinPoint) { final SourceLocation sl = thisJoinPoint.getSourceLocation(); final StringBuilder sb = new StringBuilder(sl.getWithinType().getName()); sb.append('(').append(sl.getFileName()).append(':').append(sl.getLine()).append(')'); System.out.println("Foo created here: " + sb.toString()); System.out.println("Foo created here: " + new Exception().getStackTrace()[1].toString()); } Might produce the following in my stout: Foo created here: net.kedges.Goo(Goo.java:666) Foo created here: net.kedges.Goo.createFoo(Goo.java:666) Kind Regards, Greg Kedge |
_______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
