0

I'm trying to create specific class constructor pointcut execution but I get the following marker: pointcut marker error
Aspect code:

public aspect CarLogger {
private Logger logger;

pointcut instantiate() : execution (Car.new(..));  

after() : instantiate(){
    logger.log(Level.INFO, "In Car::Car()", thisJoinPoint.getThis());
}

this code returns no match for this type name Car. But if I change execution (Car.new(..)) to execution (*.new(..)) I get all constructors in the project.
My wish is to have the pointcut execute only to the specific class Car

Gil Peretz
  • 2,399
  • 6
  • 28
  • 44
  • Can you add full name of your class (i.e. along with `package` like `com.abc.vehicle.Car.new(..)`) in place of `Car` in execution pointcut. – Naman Gala Jun 09 '15 at 05:28

1 Answers1

1

I think it is because pointcut is not able to map Car with your class, as you have not specified proper path to it i.e. full name along with package.

pointcut instantiate() : execution (com.abc.vehicle.Car.new(..)); 
Naman Gala
  • 4,670
  • 1
  • 21
  • 55