| Index: editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
|
| diff --git a/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart b/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
|
| index c3dd97079a6d9f2623a696d04a79c74005d23ffa..18888f7710d4fd1f4efd27b9b493ac76df9a102c 100644
|
| --- a/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
|
| +++ b/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
|
| @@ -84,6 +84,9 @@ class JavaArrays {
|
| class Character {
|
| static const int MAX_VALUE = 0xffff;
|
| static const int MAX_CODE_POINT = 0x10ffff;
|
| + static const int MIN_SUPPLEMENTARY_CODE_POINT = 0x010000;
|
| + static const int MIN_LOW_SURROGATE = 0xDC00;
|
| + static const int MIN_HIGH_SURROGATE = 0xD800;
|
| static bool isLetter(int c) {
|
| return c >= 0x41 && c <= 0x5A || c >= 0x61 && c <= 0x7A;
|
| }
|
| @@ -109,7 +112,16 @@ class Character {
|
| return -1;
|
| }
|
| static String toChars(int codePoint) {
|
| - throw new UnsupportedOperationException();
|
| + if (codePoint < 0 || codePoint > MAX_CODE_POINT) {
|
| + throw new IllegalArgumentException();
|
| + }
|
| + if (codePoint < MIN_SUPPLEMENTARY_CODE_POINT) {
|
| + return new String.fromCharCode(codePoint);
|
| + }
|
| + int offset = codePoint - MIN_SUPPLEMENTARY_CODE_POINT;
|
| + int c0 = ((offset & 0x7FFFFFFF) >> 10) + MIN_HIGH_SURROGATE;
|
| + int c1 = (offset & 0x3ff) + MIN_LOW_SURROGATE;
|
| + return new String.fromCharCodes([c0, c1]);
|
| }
|
| }
|
|
|
|
|