GROOVY-12267: Remove the dead declared-method check from JMX operatio… - #2804
Merged
Conversation
…n export
buildOperationMapFrom guarded operation export with
(declaredMethods.contains(name) && !OPS_EXCEPTION_LIST.contains(name))
|| (!OPS_EXCEPTION_LIST.contains(name))
which reduces to its right operand, so the declaredMethods lookup above it
was computed and never used and the comment claiming it avoided methods
from parents described something the code did not do.
Drop the dead operand and the unused lookup, and state the actual contract
in the javadoc: the default export spans the whole inheritance chain, and a
caller wanting a narrower set names the operations explicitly in a
descriptor.
Behaviour is unchanged. Making the declared-method check live instead was
considered and rejected: JmxBuilder's own embedded-descriptor fixtures
declare their operations on a base class, and 'operations: "*"' routes to
this method and has to mean all of them, so restricting to declared methods
breaks four existing tests and gives '*' a meaning it should not have.
Adds two tests pinning behaviour that was previously untested: inherited
operations are exported, and getMetaClass/setMetaClass are not, the latter
because they resolve to the metaClass MetaProperty and are dropped by the
getter/setter filter.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2804 +/- ##
==================================================
+ Coverage 70.1516% 70.1574% +0.0058%
- Complexity 35828 35829 +1
==================================================
Files 1562 1562
Lines 132523 132522 -1
Branches 24379 24379
==================================================
+ Hits 92967 92974 +7
+ Misses 31140 31136 -4
+ Partials 8416 8412 -4
🚀 New features to boost your workflow:
|
✅ All tests passed ✅🏷️ Commit: 6b6b1d0 Learn more about TestLens at testlens.app. |
blackdrag
approved these changes
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…n export
buildOperationMapFrom guarded operation export with
(declaredMethods.contains(name) && !OPS_EXCEPTION_LIST.contains(name))
|| (!OPS_EXCEPTION_LIST.contains(name))
which reduces to its right operand, so the declaredMethods lookup above it was computed and never used and the comment claiming it avoided methods from parents described something the code did not do.
Drop the dead operand and the unused lookup, and state the actual contract in the javadoc: the default export spans the whole inheritance chain, and a caller wanting a narrower set names the operations explicitly in a descriptor.
Behaviour is unchanged. Making the declared-method check live instead was considered and rejected: JmxBuilder's own embedded-descriptor fixtures declare their operations on a base class, and 'operations: ""' routes to this method and has to mean all of them, so restricting to declared methods breaks four existing tests and gives '' a meaning it should not have.
Adds two tests pinning behaviour that was previously untested: inherited operations are exported, and getMetaClass/setMetaClass are not, the latter because they resolve to the metaClass MetaProperty and are dropped by the getter/setter filter.