How do I set the disableCopyInSubstring System Property from the String class in Java? -


this snippet string class of ibm / websphere java 1.8.64

    /**     *  system property disable copying string when offset non-zero in {@link #substring(int)}} , {@link #substring(int, int)}}     */    static boolean disablecopyinsubstring; 

i want set property so.

system.setproperty("java.lang.string.disablecopyinsubstring", "true"); 

but, apparently isn't correct way set because i'm debugging string class , variable still showing false.

adding larger snippet string class i'm using. ibm's websphere java 1.8.64. when asked had thought using oracle's java. here snippet variable , up.

package java.lang;  /*  * licensed materials - property of ibm,  *     copyright ibm corp. 1998, 2016  rights reserved  */  import java.io.serializable;  import java.util.locale; import java.util.comparator; import java.io.unsupportedencodingexception;  import java.util.regex.pattern; import java.util.regex.patternsyntaxexception; import java.util.formatter; import java.util.stringjoiner; import java.util.iterator;  import java.nio.charset.charset;  /**  * strings objects represent immutable arrays of  * characters.  *  * @author      oti  * @version     initial  *  * @see         stringbuffer  */  public final class string implements serializable, comparable<string>, charsequence {     // not change or move line     // must first thing in initialization     private static final boolean string_opt_in_hw = strcheckhwavailable();     private static final long serialversionuid = -6849794470754667710l;      /**      * caseinsensitivecomparator compares strings ignoring case of      * characters.      */     private static final class caseinsensitivecomparator implements comparator<string>, serializable {         static final long serialversionuid = 8575799808933029326l;          /**          * compare 2 objects determine          * relative ordering.          *          * @param       o1  object compare          * @param       o2  object compare          * @return      int < 0 if object1 less object2,          *              0 if equal, , > 0 if object1 greater          *          * @exception   classcastexception when objects not correct type          */         public int compare(string o1, string o2) {             return o1.comparetoignorecase(o2);         }     };      /**      * comparator compares strings ignoring case of      * characters.      */     public static final comparator<string> case_insensitive_order = new caseinsensitivecomparator();     private static final char[] ascii;     private static string[] stringarray;     private static final int stringarraysize = 10;     private static class unsafehelpers {         public final static long valuefieldoffset = getvaluefieldoffset();         static long getvaluefieldoffset() {             try { return sun.misc.unsafe.getunsafe().objectfieldoffset(string.class.getdeclaredfield("value")); }             catch (nosuchfieldexception e) { throw new runtimeexception(e); }         }     }     /**      *  system property enable copy in {@link #string(string)}}      */     static boolean enablecopy;      /**     *  system property disable copying string when offset non-zero in {@link #substring(int)}} , {@link #substring(int, int)}}     */    static boolean disablecopyinsubstring; 

to set system property set following property in vm arguments.

-djava.lang.string.substring.nocopy=true 

this has solved issue. i've seen issue ibm's java implementation.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -