@Test public void makeString() throws Exception { char[] chars = "abcdef".toCharArray(); String unsafeString = LessSafe.noCopyString(chars); char[] expected = "0bcdef".toCharArray(); chars[0] = '0'; Assert.assertArrayEquals(expected, unsafeString.toCharArray()); }
public static String noCopyString(char[] chars) { if (javaLangAccess != null) { return javaLangAccess.newStringUnsafe(chars); } else { return new String(chars); } }
LessSafe { public static String noCopyString(char[] chars) { if (javaLangAccess != null) { return javaLangAccess.newStringUnsafe(chars); } else { return new String(chars); } } }
LessSafe { public static String noCopyString(char[] chars) { if (javaLangAccess != null) { return javaLangAccess.newStringUnsafe(chars); } else { return new String(chars); } } private  LessSafe(); }
LessSafe { public static String noCopyString(char[] chars) { if (javaLangAccess != null) { return javaLangAccess.newStringUnsafe(chars); } else { return new String(chars); } } private  LessSafe(); static String noCopyString(char[] chars); }
LessSafe { public static String noCopyString(char[] chars) { if (javaLangAccess != null) { return javaLangAccess.newStringUnsafe(chars); } else { return new String(chars); } } private  LessSafe(); static String noCopyString(char[] chars);  }