I have a AspectJ - Project with a aspect to making some System.out.println
's to learning a little bit about aspects etc.
The Problem is, that the advices which i define to the cuts doesn't work.
The warning which is shown is: advice defined in ShapeAspect has not been applied [Xlint:adviceDidNotMatch]
I'm working with a Mac OS X 10.10 Yosemite, Eclipse Luna Service Release 2 (4.4.2) and AspectJ Runtime: org.aspectj.runtime_1.8.5.20150128171000.jar, for the LTW classes etc.: org.aspectj.weaver_1.8.5.20150128171000.jar and additionally org.aspectj.ajde_1.8.5.20150128171000.jar.
My simple defined aspect:
public aspect ShapeAspect {
// pointcuts
pointcut myPointcut2() : execution(oldshape.Point.new(..));
// advices
before() : myPointcut2(){
System.out.println("Before init.");
}
}
EDIT: Including Point class
public class Point implements Shape{
private int x,y;
public Point(int x, int y){
this.x = x; this.y = y;
}
...
@Override
public void draw(GC gc) {
Color c = new Color(gc.getDevice(), 0, 0, 255);
gc.setForeground(c);
gc.drawPoint(this.x, this.y);
c.dispose();
}
}
public class SWTMain{
public static void main(String[] args){
Shape s1 = new Point(4,4);
s1.draw(gc);
}
}
But at the line of before()..
is the Warning: advice defined in ShapeAspect has not been applied [Xlint:adviceDidNotMatch]
What is the Problem here? On my PC with Windows it works correctly?