-
Notifications
You must be signed in to change notification settings - Fork 984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix AspectJ LTW and CTW #5064
Fix AspectJ LTW and CTW #5064
Conversation
This reverts commit 5e16809.
Fix AspectJ pointcut syntax to use `&& !` instead `and not` which is invalid for the AspectJ compiler/weaver and only works with the Spring AOP implementation. Also add `&& execution(* *.*(..))` to match only methods, because the implementation assumes it gets only MethodSignatures and crashes on ConstructorSignature at runtime. Fixed the thread-safety and mutability issues with the singleton Observations class, so changes are propagated to aspects that are initialized only once. Added AspectJ load-time weaving tests to make sure that the further issues with pointcuts and aspects are noticed at build time.
Added more class-level annotation tests and moved the module to 'micrometer-test-aspectj-ctw' to align with 'micrometer-test-aspectj-ltw'.
micrometer-core/src/main/java/io/micrometer/core/aop/CountedAspect.java
Outdated
Show resolved
Hide resolved
A fix kindly provided by @kriegaex that avoids changing the method signature and thus breaking binary compatibility and still fixes the problem with double counting in AspectJ. See the explanation in #1149 (comment)
65a1dca
into
micrometer-metrics:issues_#1149_ctw
* Revert "Fix AspectJ pointcut syntax (#5058)" This reverts commit 5e16809. * Fix AspectJ load-time weaving and class-level annotations Fix AspectJ pointcut syntax to use `&& !` instead `and not` which is invalid for the AspectJ compiler/weaver and only works with the Spring AOP implementation. Also add `&& execution(* *.*(..))` to match only methods, because the implementation assumes it gets only MethodSignatures and crashes on ConstructorSignature at runtime. Fixed the thread-safety and mutability issues with the singleton Observations class, so changes are propagated to aspects that are initialized only once. Added AspectJ load-time weaving tests to make sure that the further issues with pointcuts and aspects are noticed at build time. * Add more AspectJ compile-time tests Added more class-level annotation tests and moved the module to 'micrometer-test-aspectj-ctw' to align with 'micrometer-test-aspectj-ltw'. * Revert CountedAspect method change with simpler syntax A fix kindly provided by @kriegaex that avoids changing the method signature and thus breaking binary compatibility and still fixes the problem with double counting in AspectJ. See the explanation in #1149 (comment) --------- Co-authored-by: Marcin Grzejszczak <marcin@grzejszczak.pl>
What is the reason why this commit has been reverted? Now CTW is failing due to bad expressions in Around annotation |
We are working on proper CTW support in this PR #5059 |
* Revert "Fix AspectJ pointcut syntax (#5058)" This reverts commit 5e16809. * Fix AspectJ load-time weaving and class-level annotations Fix AspectJ pointcut syntax to use `&& !` instead `and not` which is invalid for the AspectJ compiler/weaver and only works with the Spring AOP implementation. Also add `&& execution(* *.*(..))` to match only methods, because the implementation assumes it gets only MethodSignatures and crashes on ConstructorSignature at runtime. Fixed the thread-safety and mutability issues with the singleton Observations class, so changes are propagated to aspects that are initialized only once. Added AspectJ load-time weaving tests to make sure that the further issues with pointcuts and aspects are noticed at build time. * Add more AspectJ compile-time tests Added more class-level annotation tests and moved the module to 'micrometer-test-aspectj-ctw' to align with 'micrometer-test-aspectj-ltw'. * Revert CountedAspect method change with simpler syntax A fix kindly provided by @kriegaex that avoids changing the method signature and thus breaking binary compatibility and still fixes the problem with double counting in AspectJ. See the explanation in #1149 (comment) --------- Co-authored-by: Marcin Grzejszczak <marcin@grzejszczak.pl>
OK, but those expressions were fixed, then reverted to invalid and published as 1.13.0. That is confusing to me :-( |
We never said that we supported LTW or CTW in the first place. So adding LTW and CTW support is a new feature which we wanted to add for 1.14.0. Those changes were made just before a GA so we didn't want to take chances |
@cigaly sorry that I left this here without proper explanation, this PR was meant for Marcin to be merged into his branch. Let me add a bit of clarification here. First, the commits in this PR (#5064) were not reverted, they were merged into Marcin's new PR which will add complete AspectJ load-time and compile-time weaving support: #5059 I think what you may be referring to as reverted was the commit from my earlier PR #5058 which fixed some of the pointcuts for use with AspectJ. However, this change was incomplete as it revealed some other issues in the implementation that would have caused more harm if released unfixed and due to the timing of the new release it was considered too risky, so we rather reverted to preserve the status quo and prepare a complete change for the next release (see link to Marcin's PR above). You can read the comments on my earlier PR about the issues with the initial pointcut fix e.g. #5058 (comment) or #5058 (comment) while they did fix the annotations on the method level, they led to runtime errors when the annotations were used on class level. |
* Revert "Fix AspectJ pointcut syntax (#5058)" This reverts commit 5e16809. * Fix AspectJ load-time weaving and class-level annotations Fix AspectJ pointcut syntax to use `&& !` instead `and not` which is invalid for the AspectJ compiler/weaver and only works with the Spring AOP implementation. Also add `&& execution(* *.*(..))` to match only methods, because the implementation assumes it gets only MethodSignatures and crashes on ConstructorSignature at runtime. Fixed the thread-safety and mutability issues with the singleton Observations class, so changes are propagated to aspects that are initialized only once. Added AspectJ load-time weaving tests to make sure that the further issues with pointcuts and aspects are noticed at build time. * Add more AspectJ compile-time tests Added more class-level annotation tests and moved the module to 'micrometer-test-aspectj-ctw' to align with 'micrometer-test-aspectj-ltw'. * Revert CountedAspect method change with simpler syntax A fix kindly provided by @kriegaex that avoids changing the method signature and thus breaking binary compatibility and still fixes the problem with double counting in AspectJ. See the explanation in #1149 (comment) --------- Co-authored-by: Marcin Grzejszczak <marcin@grzejszczak.pl>
Fix AspectJ pointcut syntax to use
&& !
insteadand not
which isinvalid for the AspectJ compiler/weaver and only works with the Spring
AOP implementation. Also add
&& execution(* *.*(..))
to match onlymethods, because the implementation assumes it gets only
MethodSignatures and crashes on ConstructorSignature at runtime.
Fixed the thread-safety and mutability issues with the singleton
Observations class, so changes are propagated to aspects that are
initialized only once.
Added AspectJ load-time weaving tests to make sure that the further
issues with pointcuts and aspects are noticed at build time.
Added more class-level annotation tests and moved the module to
'micrometer-test-aspectj-ctw' to align with
'micrometer-test-aspectj-ltw'.