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

Depending on your aspect, ajc may try to compile in inline in your class. I'm not sure what conditions the compiler checks for inline compilation. The surest way is to use a decompiler to check the output class file and see if you aspect has been inlined or not. If it has, there is an experimental flag you can set in your plugin definitionÂXnoInline (https://www.mojohaus.org/aspectj-maven-plugin/compile-mojo.html#XnoInline).ÂÂ

Additionally, if I remember correctly, there is also a setting in ellipse ajdt that configures the same.

Thanks,

Eric



On Tue, Aug 14, 2018, 6:58 AM Mikael Petterson, <mikaelpetterson@xxxxxxxxxxx> wrote:
Just adding a picture of my setup.


Â

Â


FrÃn: aspectj-users-bounces@xxxxxxxxxxx <aspectj-users-bounces@xxxxxxxxxxx> fÃr Mikael Petterson <mikaelpetterson@xxxxxxxxxxx>
Skickat: den 14 augusti 2018 08:46
Till: aspectj-users@xxxxxxxxxxx
Ãmne: [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


Â

Â

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Attachment: image.png
Description: PNG image