Skip to main content

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

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


Back to the top