changeset 58557:bd1f89367b9f

8241649: Optimize Character.toString Reviewed-by: redestad, rriggs Contributed-by: sergei.tsypanov@yandex.ru
author redestad
date Thu, 26 Mar 2020 10:02:57 +0100
parents 7d71520ea148
children 51acdbbcfea3
files src/java.base/share/classes/java/lang/Character.java
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/Character.java	Fri Mar 20 13:58:05 2020 +0100
+++ b/src/java.base/share/classes/java/lang/Character.java	Thu Mar 26 10:02:57 2020 +0100
@@ -3285,7 +3285,7 @@
                              "SYMBOLS AND PICTOGRAPHS EXTENDED-A",
                              "SYMBOLSANDPICTOGRAPHSEXTENDED-A");
 
-        private static final int blockStarts[] = {
+        private static final int[] blockStarts = {
             0x0000,   // 0000..007F; Basic Latin
             0x0080,   // 0080..00FF; Latin-1 Supplement
             0x0100,   // 0100..017F; Latin Extended-A
@@ -8068,7 +8068,7 @@
             UNKNOWN,                  // E01F0..10FFFF
         };
 
-        private static HashMap<String, Character.UnicodeScript> aliases;
+        private static final HashMap<String, Character.UnicodeScript> aliases;
         static {
             aliases = new HashMap<>((int)(153 / 0.75f + 1.0f));
             aliases.put("ADLM", ADLAM);
@@ -8421,8 +8421,7 @@
      * @return  a string representation of this object.
      */
     public String toString() {
-        char buf[] = {value};
-        return String.valueOf(buf);
+        return String.valueOf(value);
     }
 
     /**