Ibotta / gradle-aspectj-pipeline-plugin

A Gradle plugin for Android projects which performs AspectJ weaving using Android's bytcode manipulation pipeline.
Apache License 2.0
76 stars 14 forks source link

beakpoint not working in some folder name #20

Closed sdes5317 closed 2 years ago

sdes5317 commented 2 years ago

I'm using android stuido debug mode, and found some case that breakpoint not working. in my sample,i add a breakpoint in InjectSample.java line 14. when the file in folder name "OneFolder", breakpoint not working, but seen inject is success(Log.e("test","test success") has been invoke). if i move files(InjectSample.java,InjectSpan.java,JavaTargetExample.java) to folder name "OneFo", breakpoint is working well

Here is the sample

eschlenz commented 2 years ago

This sounds more like an IDE issue, but I'd like to help try to reproduce it anyway. I pulled down your sample code but did not see a file named InjectSample.java.

I used the sample-java project we provide to try and reproduce it instead. I moved the JavaAspect.java and JavaTargetExample.java to a subpackage named OneFolder. I then tried to hit a breakpoint, which worked:

Screen Shot 2022-04-25 at 8 45 47 AM

Next, I renamed the subpackage to OneFo, and tried to hit the breakpoint again. Again it worked:

Screen Shot 2022-04-25 at 8 46 25 AM

Maybe you can try to reproduce the issue using our sample-java project?

sdes5317 commented 2 years ago

InjectSample.java. is in the branch FolderNameBug I have tried in other computer(both ide version are the last), and OneFolder breakpoint is working, but when I changed the folder to a long name like "asdasdfg34243cz", it's not working again. I think the bug is different in other computer. maybe is IDE issue.

I will try to use sample-java to do again later

sdes5317 commented 2 years ago

Hi ,I have fork this project, and do a Sample in sample-java. I have add method injectTest by @Around annotation in JavaAspect.java, and then add breakpoint in line 25. It's seen breakpoint not working, and I have tried in two computer with same situation

eschlenz commented 2 years ago

How bizarre!! Thanks for the sample app. That allowed me to reproduce it. Unfortunately, I don't believe there is anything we can do to fix it.

I did some research and it sounds like the reason this happens is because the entire method is replaced in bytecode by a synthetic method. This seems to be a quirk of both AspectJ and IDEs. Here are some links to people discussing this issue:

https://youtrack.jetbrains.com/issue/IDEA-142437 https://intellij-support.jetbrains.com/hc/en-us/community/posts/206156169-AspectJ-Why-Don-t-Around-JoinPoint-Breakpoints-Get-Hit- https://www.google.com/search?q=aspectj+%40around+breakpoint&rlz=1C5GCEM_enUS945US945&oq=aspectj+%40around+breakpoint&aqs=chrome..69i57.7410j0j7&sourceid=chrome&ie=UTF-8

sdes5317 commented 2 years ago

thx! It's Confusing, but seen the inject is working well. I will closed the issue.