Commit e3f320e
committed
GROOVY-12267: Remove the dead declared-method check from JMX operation 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.1 parent c32090e commit e3f320e
2 files changed
Lines changed: 31 additions & 4 deletions
File tree
- subprojects/groovy-jmx/src
- main/groovy/groovy/jmx/builder
- test/groovy/groovy/jmx/builder
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
392 | 397 | | |
393 | 398 | | |
394 | 399 | | |
395 | 400 | | |
396 | 401 | | |
397 | 402 | | |
398 | 403 | | |
399 | | - | |
400 | | - | |
401 | 404 | | |
402 | | - | |
403 | | - | |
| 405 | + | |
404 | 406 | | |
405 | 407 | | |
406 | 408 | | |
| |||
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
343 | 368 | | |
344 | 369 | | |
345 | 370 | | |
| |||
0 commit comments