Community
Participate
Working Groups
The experimental hasmethod() pointcut matches methods that are declared in superclasses. Having a hasDeclaredMethod() pointcut would allow to provide different implementation for a method without risking conflicts with Inter Type Declarations. Example: aspect myITD { public void MyHelloInterface.sayHello() { System.out.println("hello"); } declare parents: !hasDeclaredMethod(void *.sayHello()) implements MyHelloInterface; } This way the ITD would never clash with classes that already have a sayHello(). Sometimes we could achieve this result, by injecting the ITD into the superclass of the class we want to advise, but that is not always possible.