From df55cc64e55f4119c97ebd62edaa79a00fc4865b Mon Sep 17 00:00:00 2001 From: coffeys Date: Tue, 29 Jan 2019 22:37:37 +0000 Subject: [PATCH] 8216396: Support new Japanese era and new currency code points in java.lang.Character for Java SE 8 Reviewed-by: chegar, naoto, rriggs, coffeys Contributed-by: deepak.kejriwal@oracle.com --- src/share/classes/java/lang/Character.java | 76 +++++++++++++++------- 1 file changed, 54 insertions(+), 22 deletions(-) diff --git a/src/share/classes/java/lang/Character.java b/src/share/classes/java/lang/Character.java index 60f05f0e7..aec1cf752 100644 --- a/src/share/classes/java/lang/Character.java +++ b/src/share/classes/java/lang/Character.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2019, 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 @@ -32,27 +32,41 @@ import java.util.Locale; /** * The {@code Character} class wraps a value of the primitive - * type {@code char} in an object. An object of type + * type {@code char} in an object. An object of class * {@code Character} contains a single field whose type is * {@code char}. *

- * In addition, this class provides several methods for determining - * a character's category (lowercase letter, digit, etc.) and for converting - * characters from uppercase to lowercase and vice versa. - *

- * Character information is based on the Unicode Standard, version 6.2.0. + * In addition, this class provides a large number of static methods for + * determining a character's category (lowercase letter, digit, etc.) + * and for converting characters from uppercase to lowercase and vice + * versa. + * + *

Unicode Conformance

*

- * The methods and data of class {@code Character} are defined by - * the information in the UnicodeData file that is part of the - * Unicode Character Database maintained by the Unicode - * Consortium. This file specifies various properties including name - * and general category for every defined Unicode code point or - * character range. + * The fields and methods of class {@code Character} are defined in terms + * of character information from the Unicode Standard, specifically the + * UnicodeData file that is part of the Unicode Character Database. + * This file specifies properties including name and category for every + * assigned Unicode code point or character range. The file is available + * from the Unicode Consortium at + * http://www.unicode.org. *

- * The file and its description are available from the Unicode Consortium at: - *

+ * The Java SE 8 Platform uses character information from version 6.2 + * of the Unicode Standard, with two extensions. First, the Java SE 8 Platform + * allows an implementation of class {@code Character} to use the Japanese Era + * code point, {@code U+32FF}, from the first version of the Unicode Standard + * after 6.2 that assigns the code point. Second, in recognition of the fact + * that new currencies appear frequently, the Java SE 8 Platform allows an + * implementation of class {@code Character} to use the Currency Symbols + * block from version 10.0 of the Unicode Standard. Consequently, the + * behavior of fields and methods of class {@code Character} may vary across + * implementations of the Java SE 8 Platform when processing the aforementioned + * code points ( outside of version 6.2 ), except for the following methods + * that define Java identifiers: + * {@link #isJavaIdentifierStart(int)}, {@link #isJavaIdentifierStart(char)}, + * {@link #isJavaIdentifierPart(int)}, and {@link #isJavaIdentifierPart(char)}. + * Code points in Java identifiers must be drawn from version 6.2 of + * the Unicode Standard. * *

Unicode Character Representations

* @@ -5859,7 +5873,7 @@ class Character implements java.io.Serializable, Comparable { * character in a Java identifier. *

* A character may start a Java identifier if and only if - * one of the following is true: + * one of the following conditions is true: *

* + * These conditions are tested against the character information from version + * 6.2 of the Unicode Standard. + * * @param ch the character to be tested. * @return {@code true} if the character may start a Java * identifier; {@code false} otherwise. @@ -5889,7 +5906,7 @@ class Character implements java.io.Serializable, Comparable { * identifier as other than the first character. *

* A character may be part of a Java identifier if and only if any - * of the following are true: + * of the following conditions are true: *

    *
  • it is a letter *
  • it is a currency symbol (such as {@code '$'}) @@ -5902,6 +5919,9 @@ class Character implements java.io.Serializable, Comparable { * {@code true} for the character. *
* + * These conditions are tested against the character information from version + * 6.2 of the Unicode Standard. + * * @param ch the character to be tested. * @return {@code true} if the character may be part of a * Java identifier; {@code false} otherwise. @@ -5979,6 +5999,9 @@ class Character implements java.io.Serializable, Comparable { *
  • {@code ch} is a connecting punctuation character (such as {@code '_'}). * * + * These conditions are tested against the character information from version + * 6.2 of the Unicode Standard. + * *

    Note: This method cannot handle supplementary characters. To support * all Unicode characters, including supplementary characters, use @@ -6013,6 +6036,9 @@ class Character implements java.io.Serializable, Comparable { * (such as {@code '_'}). * * + * These conditions are tested against the character information from version + * 6.2 of the Unicode Standard. + * * @param codePoint the character (Unicode code point) to be tested. * @return {@code true} if the character may start a Java identifier; * {@code false} otherwise. @@ -6031,7 +6057,7 @@ class Character implements java.io.Serializable, Comparable { * identifier as other than the first character. *

    * A character may be part of a Java identifier if any of the following - * are true: + * conditions are true: *

      *
    • it is a letter *
    • it is a currency symbol (such as {@code '$'}) @@ -6044,6 +6070,9 @@ class Character implements java.io.Serializable, Comparable { * {@code true} for the character *
    * + * These conditions are tested against the character information from version + * 6.2 of the Unicode Standard. + * *

    Note: This method cannot handle supplementary characters. To support * all Unicode characters, including supplementary characters, use @@ -6068,7 +6097,7 @@ class Character implements java.io.Serializable, Comparable { * identifier as other than the first character. *

    * A character may be part of a Java identifier if any of the following - * are true: + * conditions are true: *

      *
    • it is a letter *
    • it is a currency symbol (such as {@code '$'}) @@ -6079,9 +6108,12 @@ class Character implements java.io.Serializable, Comparable { *
    • it is a non-spacing mark *
    • {@link #isIdentifierIgnorable(int) * isIdentifierIgnorable(codePoint)} returns {@code true} for - * the character + * the code point *
    * + * These conditions are tested against the character information from version + * 6.2 of the Unicode Standard. + * * @param codePoint the character (Unicode code point) to be tested. * @return {@code true} if the character may be part of a * Java identifier; {@code false} otherwise. -- GitLab