This is an automated email from the ASF dual-hosted git repository.
henrib pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jexl.git
The following commit(s) were added to refs/heads/master by this push:
new feef383 JEXL-260: performance regression fix
feef383 is described below
commit feef3837bd6cd43fddac1f30790f0440c956c5cf
Author: henrib <[email protected]>
AuthorDate: Wed May 23 14:20:08 2018 +0200
JEXL-260: performance regression fix
---
.../java/org/apache/commons/jexl3/internal/Interpreter.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/commons/jexl3/internal/Interpreter.java
b/src/main/java/org/apache/commons/jexl3/internal/Interpreter.java
index e7761fa..7c39199 100644
--- a/src/main/java/org/apache/commons/jexl3/internal/Interpreter.java
+++ b/src/main/java/org/apache/commons/jexl3/internal/Interpreter.java
@@ -257,7 +257,7 @@ public class Interpreter extends InterpreterBase {
Object functor = null;
if (namespace instanceof JexlContext.NamespaceFunctor) {
functor = ((JexlContext.NamespaceFunctor)
namespace).createFunctor(context);
- } else if (namespace != null) {
+ } else if (namespace instanceof Class<?> || namespace instanceof
String) {
// attempt to reuse last ctor cached in volatile JexlNode.value
if (cached instanceof JexlMethod) {
Object eval = ((JexlMethod) cached).tryInvoke(null,
context);
@@ -1690,10 +1690,12 @@ public class Interpreter extends InterpreterBase {
}
// if we did not find an exact method by name and we haven't
tried yet,
// attempt to narrow the parameters and if this succeeds, try
again in next loop
- if (!arithmetic.narrowArguments(argv)) {
- break;
+ if (!narrow && arithmetic.narrowArguments(argv)) {
+ narrow = true;
+ continue;
}
- narrow = true;
+ // stop trying
+ break;
}
// we have either evaluated and returned or might have found a
method
if (vm != null) {
@@ -1763,7 +1765,7 @@ public class Interpreter extends InterpreterBase {
}
// if we did not find an exact method by name and we haven't
tried yet,
// attempt to narrow the parameters and if this succeeds, try
again in next loop
- if (arithmetic.narrowArguments(argv)) {
+ if (!narrow && arithmetic.narrowArguments(argv)) {
narrow = true;
continue;
}
--
To stop receiving notification emails like this one, please contact
[email protected].