diff options
author | Thomas Watson | 2019-12-17 21:43:59 +0000 |
---|---|---|
committer | Thomas Watson | 2019-12-18 14:29:16 +0000 |
commit | c533d05d55f28631a1606323b613b91f5a1097e4 (patch) | |
tree | f4f3a0ca4fff002f4c7ff9769923cedb0f7fb6cb | |
parent | 6a0dfb4c51443b996735b5c95d0b83b4523d742d (diff) | |
download | rt.equinox.framework-c533d05d55f28631a1606323b613b91f5a1097e4.tar.gz rt.equinox.framework-c533d05d55f28631a1606323b613b91f5a1097e4.tar.xz rt.equinox.framework-c533d05d55f28631a1606323b613b91f5a1097e4.zip |
Bug 558371 - Avoid use of MethodHandleY20200103-2350I20200106-1805I20200106-0600I20200105-1800I20200105-0955I20200105-0600I20200104-1800I20200104-0625I20200104-0600I20200103-1800I20200102-1800I20200101-1800I20191231-1800I20191230-1800I20191229-2200I20191229-1800I20191228-1800I20191227-1800I20191226-1800I20191225-1800I20191224-1800I20191223-1800I20191222-1800I20191221-2205I20191221-1800I20191220-1805I20191219-1800I20191218-1805
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.java | 8 |
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) { |