[
https://issues.apache.org/jira/browse/GROOVY-2807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18149448#comment-18149448
]
ASF GitHub Bot commented on GROOVY-2807:
----------------------------------------
testlens-app[bot] commented on PR #3333:
URL: https://github.com/apache/groovy/pull/3333#issuecomment-7087917181
## ✅ All tests passed ✅
🏷️ Commit: 89da22f27a83b90e0b4cf6b31b3bd417f0fbacc4
▶️ Tests: 133810 executed
⚪️ Checks: 26/26 completed
---
_Learn more about TestLens at
[testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
> GroovyMBean does not support the use of overloaded MBean operations that have
> the same number of parameters
> -----------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-2807
> URL: https://issues.apache.org/jira/browse/GROOVY-2807
> Project: Groovy
> Issue Type: Bug
> Components: groovy-jmx
> Reporter: Meyrick Kirby
> Assignee: Daniel Sun
> Priority: Major
> Attachments: GroovyMBean.java
>
>
> I've been using groovy.util.GroovyMBean to access MBeans running on the JBoss
> 4 server. Some of the operations/methods of the MBeans are overloaded, e.g.:
> {code}
> void redeploy(java.lang.String url)
> void redeploy(java.net.URL url)
> void redeploy(org.jboss.deployment.DeploymentInfo sdi)
> {code}
> Currently it's impossible to invoke the first 2.
> The problem is, when the GroovyMBean is constructed it stores a signature for
> each operation from its specified MBean in a HashMap, using the operation
> name and the number of parameters as its key. Later, when the invokeMethod
> method is invoked, it uses the method name and the number of parameters to
> retrieve the signature to invoke the operation on the MBean. Thus for
> overloaded operations with the same number of parameters, only the last
> operation found will be stored in the HashMap.
> If another variant of the operation is invoked on the GroovyMBean then an
> incorrect signature will be passed to the MBeanServer which results in an
> exception occurring on the server.
> The fix I've used (suggested by a comment in the source code) is to
> construct a key out of the name of the operation and the sum of the hash
> codes of the class names of the parameters.
> The problem is, this required 2 new createOperationKey methods:
> {code}
> String createOperationKey(MBeanOperationInfo opInfo)
> String createOperationKey(String method, Object[] args)
> {code}
> The first is invoked by the constructor, and the second that is invoked by
> the invokeMethod method. The original createOperationKey method is removed.
> This might create backwards compatibility problems.
> I've included an adjusted GroovyMBean class, although temporarily in a new
> package (groovy.util.adjusted).
> This issue is an extension of issue GROOVY-1291
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)