src/java.base/share/classes/java/lang/Character.java
changeset 49129 fb9f590b9eee
parent 47216 71c04702a3d5
child 49203 3a225d9cabe1
--- a/src/java.base/share/classes/java/lang/Character.java	Mon Mar 05 08:27:42 2018 -0800
+++ b/src/java.base/share/classes/java/lang/Character.java	Mon Mar 05 08:50:47 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -7568,6 +7568,11 @@
      * specified {@code char}.  The result is a string of length
      * 1 consisting solely of the specified {@code char}.
      *
+     * @apiNote This method cannot handle <a
+     * href="#supplementary"> supplementary characters</a>. To support
+     * all Unicode characters, including supplementary characters, use
+     * the {@link #toString(int)} method.
+     *
      * @param c the {@code char} to be converted
      * @return the string representation of the specified {@code char}
      * @since 1.4
@@ -7577,6 +7582,22 @@
     }
 
     /**
+     * Returns a {@code String} object representing the
+     * specified character (Unicode code point).  The result is a string of
+     * length 1 or 2, consisting solely of the specified {@code codePoint}.
+     *
+     * @param codePoint the {@code codePoint} to be converted
+     * @return the string representation of the specified {@code codePoint}
+     * @exception IllegalArgumentException if the specified
+     *      {@code codePoint} is not a {@linkplain #isValidCodePoint
+     *      valid Unicode code point}.
+     * @since 11
+     */
+    public static String toString(int codePoint) {
+        return String.valueOfCodePoint(codePoint);
+    }
+
+    /**
      * Determines whether the specified code point is a valid
      * <a href="http://www.unicode.org/glossary/#code_point">
      * Unicode code point value</a>.