[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Debug aspect

Hi,

I have an application A in Eclipse that uses another library  that has an aspect implemented. Purpose of of aspect is to see when application A
calls deprecated methods in the library.

Both application A and library are java maven projects in Eclipse. Application A has a dependency to the library and I can see that in Eclipse. So I have the source
available for both projects. In eclipse the library is also a aspect project so I can see when it builds it output saying "woven class".

What I want to accomplish is , when I run a class in application A that calls a deprecated method in the library, I want the debugger to halt in my aspect.

Here is where I set my breakpoint:

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

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

    pointcut deprecatedMethods() :
        deprecated() && !beta();

before() : deprecatedMethods() {
        DeprecatedMethodData deprecatedMethodData = new DeprecatedMethodData();
        System.out.println(
                "Deprecated method " + thisJoinPoint.getSignature() +
                        " called by " + thisEnclosingJoinPointStaticPart.getSignature());
        deprecatedMethodData.setDeprecatedClassName(thisJoinPoint.getSignature().toString());
        deprecatedMethodData.setCallingClassName(thisEnclosingJoinPointStaticPart.getSignature().toString());
        deprecatedMethodData.setAccess(Access.EXTERNAL);
        deprecatedMethodData.setUser(JavaProperties.USER);
        deprecatedMethodData.setUserDir(JavaProperties.USER_DIR);
        deprecationDataList.add(deprecatedMethodData);


But there is no halt on:

  DeprecatedMethodData deprecatedMethodData = new DeprecatedMethodData();

where I put my breakpoint on.

Any ideas what I am lacking?

br,

//mike