8152074: Avoid lambda usage in StringConcatFactory initializer
Reviewed-by: shade, forax, chegar
--- a/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java Tue Mar 15 12:27:26 2016 +0900
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java Thu Mar 17 10:26:59 2016 +0100
@@ -34,11 +34,11 @@
import java.lang.invoke.MethodHandles.Lookup;
import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.function.Function;
+import sun.security.action.GetPropertyAction;
import static jdk.internal.org.objectweb.asm.Opcodes.*;
@@ -188,20 +188,14 @@
private static final ProxyClassesDumper DUMPER;
static {
- // Poke the privileged block once, taking everything we need:
- final Object[] values = new Object[4];
- AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
- values[0] = System.getProperty("java.lang.invoke.stringConcat");
- values[1] = Boolean.getBoolean("java.lang.invoke.stringConcat.cache");
- values[2] = Boolean.getBoolean("java.lang.invoke.stringConcat.debug");
- values[3] = System.getProperty("java.lang.invoke.stringConcat.dumpClasses");
- return null;
- });
-
- final String strategy = (String) values[0];
- CACHE_ENABLE = (Boolean) values[1];
- DEBUG = (Boolean) values[2];
- final String dumpPath = (String) values[3];
+ final String strategy = AccessController.doPrivileged(
+ new GetPropertyAction("java.lang.invoke.stringConcat"));
+ CACHE_ENABLE = Boolean.parseBoolean(AccessController.doPrivileged(
+ new GetPropertyAction("java.lang.invoke.stringConcat.cache")));
+ DEBUG = Boolean.parseBoolean(AccessController.doPrivileged(
+ new GetPropertyAction("java.lang.invoke.stringConcat.debug")));
+ final String dumpPath = AccessController.doPrivileged(
+ new GetPropertyAction("java.lang.invoke.stringConcat.dumpClasses"));
STRATEGY = (strategy == null) ? DEFAULT_STRATEGY : Strategy.valueOf(strategy);
CACHE = CACHE_ENABLE ? new ConcurrentHashMap<>() : null;