Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2019-12-17 21:43:59 +0000
committerThomas Watson2019-12-18 14:29:16 +0000
commitc533d05d55f28631a1606323b613b91f5a1097e4 (patch)
treef4f3a0ca4fff002f4c7ff9769923cedb0f7fb6cb
parent6a0dfb4c51443b996735b5c95d0b83b4523d742d (diff)
downloadrt.equinox.framework-I20191218-1805.tar.gz
rt.equinox.framework-I20191218-1805.tar.xz
rt.equinox.framework-I20191218-1805.zip
Use of method handles does not seem to improve performance. In my testing it actually makes things slower on Java 8. Particularly the use of MethodHandle for calling the constructor for the value to match against. Substrate also doesn't like the use of MethodHandles in the FilterImpl. For now I think we should avoid using them unless they show a clear performance win. Change-Id: I220cb2cde0a7c5bf948db6e34f8d337e3a4ce0f8 Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java8
1 files changed, 2 insertions, 6 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java
index 96b87ce00..f718ea1fe 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java
@@ -14,10 +14,8 @@
package org.eclipse.osgi.internal.framework;
-import static java.lang.invoke.MethodHandles.publicLookup;
import static java.util.Objects.requireNonNull;
-import java.lang.invoke.MethodHandle;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
@@ -787,8 +785,7 @@ public abstract class FilterImpl implements Filter {
if (Modifier.isStatic(method.getModifiers()) && target.isAssignableFrom(method.getReturnType())) {
setAccessible(method);
try {
- MethodHandle mh = publicLookup().unreflect(method);
- return mh.invoke(value2.trim());
+ return method.invoke(null, value2.trim());
} catch (Error e) {
throw e;
} catch (Throwable e) {
@@ -806,8 +803,7 @@ public abstract class FilterImpl implements Filter {
}
setAccessible(constructor);
try {
- MethodHandle mh = publicLookup().unreflectConstructor(constructor);
- return mh.invoke(value2.trim());
+ return constructor.newInstance(value2.trim());
} catch (Error e) {
throw e;
} catch (Throwable e) {

Back to the top