Spring - Aspectj is not getting applied over obfuscated(YGuard) binaries(jars)

559 Views Asked by At

I have one jar in which I have used the Aspect to have point cuts around a method. The aspect works fine here and around advice gets executed properly around the method at runtime. But when I obfuscate this jar and execute it then it gives me below error at console:

[AppClassLoader@dad5dc] error at Type 'com.test.imp.aspect.AspectObf' (no debug info available)::0 Cannot read debug info for @Aspect to handle formal binding in pointcuts (please compile with 'javac -g' or '' in Ant)

Please help.

1

There are 1 best solutions below

0
On

Well, the error message says it all and even tells you how to solve the problem: Obviously you use formal parameter binding, e.g. via args(), this(), target(), @annotation() or similar. And obviosly AspectJ needs debug info in order for this to work. So you should configure yGuard to exclude stripping debug info from your aspect and maybe even not obfuscating it, you got to try for yourself. Another option might be to use native AspectJ syntax instead of annotation style. Then maybe the AspectJ compiler can resolve parameter bindings during compile time rather than during runtime, but I am not sure.