Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] capturing implicit toString() function calls

Don't suppose you can use the execution pointcut? That would capture the execution of toString() regardless of how it was invoked.

Cheers,

Russ

On Thursday, November 11, 2004, at 12:27PM, Benjamin Mesing <benjamin.mesing@xxxxxxxxxxxxxxx> wrote:

>Hello,
>
>I have stumbled over a problem. When specifying a pointcut, implicit 
>calls of toString functions will not be captured. Consider the following 
>example, wher "jpt hit" will be printed only once.
>Is there anything I can do about it?
>
>public class HelloWorld {
>
>	public static void main(String[] args) {
>		HelloWorld hw = new HelloWorld();
>		// here occurs an explicit and an implicit call of
>		// toString()
>		System.out.println(hw.toString() + hw);
>	}
>	public String toString()
>	{
>		return "Hello World ";
>	}
>}
>
>public aspect TestAspect
>{
>	before() : call (String HelloWorld.toString())
>	{
>		System.out.println("jpt hit");
>	}
>}
>
>Greetings Ben
>_______________________________________________
>aspectj-users mailing list
>aspectj-users@xxxxxxxxxxx
>http://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top