< prev index next >

src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java

Print this page

        

@@ -121,11 +121,11 @@
 
     /**
      * Concatenation strategy to use. See {@link Strategy} for possible options.
      * This option is controllable with -Djava.lang.invoke.stringConcat JDK option.
      */
-    private static final Strategy STRATEGY;
+    private static Strategy STRATEGY;
 
     /**
      * Default strategy to use for concatenation.
      */
     private static final Strategy DEFAULT_STRATEGY = Strategy.BC_SB;

@@ -185,10 +185,20 @@
      * Dump generated classes to disk, for debugging purposes.
      */
     private static final ProxyClassesDumper DUMPER;
 
     static {
+        // In case we need to double-back onto the StringConcatFactory during this
+        // static initialization, make sure we have the reasonable defaults to complete
+        // the static initialization properly. After that, actual users would use the
+        // the proper values we have read from the the properties.
+        STRATEGY = DEFAULT_STRATEGY;
+        // CACHE_ENABLE = false; // implied
+        // CACHE = null;         // implied
+        // DEBUG = false;        // implied
+        // DUMPER = null;        // implied
+
         Properties props = GetPropertyAction.getProperties();
         final String strategy =
                 props.getProperty("java.lang.invoke.stringConcat");
         CACHE_ENABLE = Boolean.parseBoolean(
                 props.getProperty("java.lang.invoke.stringConcat.cache"));
< prev index next >