Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] call and execution pointcut problem

Hi,

I am using:

3:3:33 Startup information:
   AJDT version: 2.2.4.202202111622
   AspectJ Compiler version: 1.9.7.BUILD-SNAPSHOT
   usingVisualiser=true
   usingXref=true
   usingCUprovider=true
   org.eclipse.ajdt.internal.ui.tracing.checked.filters = set: Compiler,Builder
   ajde.version.at.previous.startup = 2.2.4.202202111622

in Eclipse.

I have the following maven modules:

1.Aspects
2.Sim
3.Test

Aspect looks like:

public aspect DeprecatedMethodsAspect {

    static boolean enabled = false;
    //Only allow a default constructor with no args in aspect.
     
    pointcut active(): if(enabled);

    pointcut beta() :
        @annotation(com.google.common.annotations.Beta);

    pointcut deprecatedClassesAndMethods() :
        @annotation(Deprecated) && (call(public * *(..)) || call(*.new(..)));

    pointcut deprecatedMethods() :
        deprecatedClassesAndMethods() && !within(com.ericsson.commonlibrary.statisticscollectorframework.aspectj.*) && active();

    before() : deprecatedMethods() {
   
    System.out.println(thisJoinPoint);
        DeprecatedDataHolder.collect(thisJoinPoint);

    }

}

I have built Aspect and weaved it into Sim module using the

  <aspectLibraries>
                        <aspectLibrary>

tags.

I add a @Deprecated method in Sim module on a  class method.

Then I let one of my tests in Test module call the method annotated @Deprecated in Sim module.

When using 'call' in the aspect I don't see the  info, println in aspect, of my deprecated method in Sim module being called.

However if I change to 'execution' in my aspect then I can see that the info of my method in Sim module being called. All other things the same.
Problem with this is  I cannot see the calling class. There is no info for that when using 'execution'.

Is this is a bug? Or am I using it in the wrong way?

br,

//mike



 

 


Back to the top