Allow JsonNodeELResolver to invoke methods #3996
Open
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.
This PR proposes a change to the
Util
class to fix a problem in the BeanELResolver, when invoking theget
method on anArrayNode
.In this commit, the logic of the BeanELResolver was enhanced to better deal with method overloading.
We encountered some inconsistencies in the Behavior of the BeanELResolver compared to an older flowable release (in our case 6.6.0)
The ArrayNode has two methods with the name "get":
Before the mentioned commit, it was possible to use the BeanELResolver to invoke
ArrayNode::get
and pass a Long as parameter, which is no longer possible. Even though none of the two methods apply to a Long (without casting it to an int), I think that there is still a benefit in supporting it:${array.get(0)}
as a Long. Therefore, the BeanELResolver will try to invoke "get" with a Long as parameter.I have added a unit test to demonstrate the problem. With the modification to the
Util
class, the test passes. Without it, it fails. When the test is executed on the state offlowable-6.6.0
(some release before the logic of the BeanELResolver was changed), it passes as well.Without the modification, the test fails with the following exception:
org.flowable.common.engine.impl.javax.el.MethodNotFoundException: Unable to find unambiguous method: class com.fasterxml.jackson.databind.node.ArrayNode.get(java.lang.Long)
Check List: