From 64624cb4646f37c6f1dcef3ef5b4290bc584d000 Mon Sep 17 00:00:00 2001 From: Babneet Singh Date: Tue, 23 Jun 2020 20:04:41 -0700 Subject: [PATCH] Do not use rebind in StringConcatFactory OpenJ9 does not support MethodHandle.rebind. So, its usage has been temporarily removed from StringConcatFactory until OpenJ9 supports OpenJDK MethodHandles. Fixes: eclipse/openj9#9771 Signed-off-by: Babneet Singh --- .../java/lang/invoke/StringConcatFactory.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java index 5ff0cf84aec..71f1626225d 100644 --- a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java +++ b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java @@ -22,6 +22,11 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ +/* + * =========================================================================== + * (c) Copyright IBM Corp. 2020, 2020 All Rights Reserved. + * =========================================================================== + */ package java.lang.invoke; @@ -646,7 +651,7 @@ public MethodHandle apply(Class c) { MethodHandle prepend = JLA.stringConcatHelper("prepend", methodType(long.class, long.class, byte[].class, Wrapper.asPrimitiveType(c), String.class)); - return prepend.rebind(); + return prepend; } }; @@ -663,7 +668,7 @@ public MethodHandle apply(Class c) { public MethodHandle apply(Class c) { MethodHandle mix = JLA.stringConcatHelper("mix", methodType(long.class, long.class, Wrapper.asPrimitiveType(c))); - return mix.rebind(); + return mix; } }; @@ -673,7 +678,7 @@ private static MethodHandle simpleConcat() { if (mh == null) { MethodHandle simpleConcat = JLA.stringConcatHelper("simpleConcat", methodType(String.class, Object.class, Object.class)); - SIMPLE_CONCAT = mh = simpleConcat.rebind(); + SIMPLE_CONCAT = mh = simpleConcat; } return mh; } @@ -684,7 +689,7 @@ private static MethodHandle newString() { if (mh == null) { MethodHandle newString = JLA.stringConcatHelper("newString", methodType(String.class, byte[].class, long.class)); - NEW_STRING = mh = newString.rebind(); + NEW_STRING = mh = newString; } return mh; } @@ -695,7 +700,7 @@ private static MethodHandle newArrayWithSuffix(String suffix) { if (mh == null) { MethodHandle newArrayWithSuffix = JLA.stringConcatHelper("newArrayWithSuffix", methodType(byte[].class, String.class, long.class)); - NEW_ARRAY_SUFFIX = mh = newArrayWithSuffix.rebind(); + NEW_ARRAY_SUFFIX = mh = newArrayWithSuffix; } return MethodHandles.insertArguments(mh, 0, suffix); }