提交 df55cc64 编写于 作者: C coffeys

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
上级 6c78e3d5
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -32,27 +32,41 @@ import java.util.Locale; ...@@ -32,27 +32,41 @@ import java.util.Locale;
/** /**
* The {@code Character} class wraps a value of the primitive * 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 Character} contains a single field whose type is
* {@code char}. * {@code char}.
* <p> * <p>
* In addition, this class provides several methods for determining * In addition, this class provides a large number of static methods for
* a character's category (lowercase letter, digit, etc.) and for converting * determining a character's category (lowercase letter, digit, etc.)
* characters from uppercase to lowercase and vice versa. * and for converting characters from uppercase to lowercase and vice
* <p> * versa.
* Character information is based on the Unicode Standard, version 6.2.0. *
* <h3><a id="conformance">Unicode Conformance</a></h3>
* <p> * <p>
* The methods and data of class {@code Character} are defined by * The fields and methods of class {@code Character} are defined in terms
* the information in the <i>UnicodeData</i> file that is part of the * of character information from the Unicode Standard, specifically the
* Unicode Character Database maintained by the Unicode * <i>UnicodeData</i> file that is part of the Unicode Character Database.
* Consortium. This file specifies various properties including name * This file specifies properties including name and category for every
* and general category for every defined Unicode code point or * assigned Unicode code point or character range. The file is available
* character range. * from the Unicode Consortium at
* <a href="http://www.unicode.org">http://www.unicode.org</a>.
* <p> * <p>
* The file and its description are available from the Unicode Consortium at: * The Java SE 8 Platform uses character information from version 6.2
* <ul> * of the Unicode Standard, with two extensions. First, the Java SE 8 Platform
* <li><a href="http://www.unicode.org">http://www.unicode.org</a> * allows an implementation of class {@code Character} to use the Japanese Era
* </ul> * 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.
* *
* <h3><a name="unicode">Unicode Character Representations</a></h3> * <h3><a name="unicode">Unicode Character Representations</a></h3>
* *
...@@ -5859,7 +5873,7 @@ class Character implements java.io.Serializable, Comparable<Character> { ...@@ -5859,7 +5873,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* character in a Java identifier. * character in a Java identifier.
* <p> * <p>
* A character may start a Java identifier if and only if * A character may start a Java identifier if and only if
* one of the following is true: * one of the following conditions is true:
* <ul> * <ul>
* <li> {@link #isLetter(char) isLetter(ch)} returns {@code true} * <li> {@link #isLetter(char) isLetter(ch)} returns {@code true}
* <li> {@link #getType(char) getType(ch)} returns {@code LETTER_NUMBER} * <li> {@link #getType(char) getType(ch)} returns {@code LETTER_NUMBER}
...@@ -5867,6 +5881,9 @@ class Character implements java.io.Serializable, Comparable<Character> { ...@@ -5867,6 +5881,9 @@ class Character implements java.io.Serializable, Comparable<Character> {
* <li> {@code ch} is a connecting punctuation character (such as {@code '_'}). * <li> {@code ch} is a connecting punctuation character (such as {@code '_'}).
* </ul> * </ul>
* *
* These conditions are tested against the character information from version
* 6.2 of the Unicode Standard.
*
* @param ch the character to be tested. * @param ch the character to be tested.
* @return {@code true} if the character may start a Java * @return {@code true} if the character may start a Java
* identifier; {@code false} otherwise. * identifier; {@code false} otherwise.
...@@ -5889,7 +5906,7 @@ class Character implements java.io.Serializable, Comparable<Character> { ...@@ -5889,7 +5906,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* identifier as other than the first character. * identifier as other than the first character.
* <p> * <p>
* A character may be part of a Java identifier if and only if any * 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:
* <ul> * <ul>
* <li> it is a letter * <li> it is a letter
* <li> it is a currency symbol (such as {@code '$'}) * <li> it is a currency symbol (such as {@code '$'})
...@@ -5902,6 +5919,9 @@ class Character implements java.io.Serializable, Comparable<Character> { ...@@ -5902,6 +5919,9 @@ class Character implements java.io.Serializable, Comparable<Character> {
* {@code true} for the character. * {@code true} for the character.
* </ul> * </ul>
* *
* These conditions are tested against the character information from version
* 6.2 of the Unicode Standard.
*
* @param ch the character to be tested. * @param ch the character to be tested.
* @return {@code true} if the character may be part of a * @return {@code true} if the character may be part of a
* Java identifier; {@code false} otherwise. * Java identifier; {@code false} otherwise.
...@@ -5979,6 +5999,9 @@ class Character implements java.io.Serializable, Comparable<Character> { ...@@ -5979,6 +5999,9 @@ class Character implements java.io.Serializable, Comparable<Character> {
* <li> {@code ch} is a connecting punctuation character (such as {@code '_'}). * <li> {@code ch} is a connecting punctuation character (such as {@code '_'}).
* </ul> * </ul>
* *
* These conditions are tested against the character information from version
* 6.2 of the Unicode Standard.
*
* <p><b>Note:</b> This method cannot handle <a * <p><b>Note:</b> This method cannot handle <a
* href="#supplementary"> supplementary characters</a>. To support * href="#supplementary"> supplementary characters</a>. To support
* all Unicode characters, including supplementary characters, use * all Unicode characters, including supplementary characters, use
...@@ -6013,6 +6036,9 @@ class Character implements java.io.Serializable, Comparable<Character> { ...@@ -6013,6 +6036,9 @@ class Character implements java.io.Serializable, Comparable<Character> {
* (such as {@code '_'}). * (such as {@code '_'}).
* </ul> * </ul>
* *
* 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. * @param codePoint the character (Unicode code point) to be tested.
* @return {@code true} if the character may start a Java identifier; * @return {@code true} if the character may start a Java identifier;
* {@code false} otherwise. * {@code false} otherwise.
...@@ -6031,7 +6057,7 @@ class Character implements java.io.Serializable, Comparable<Character> { ...@@ -6031,7 +6057,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* identifier as other than the first character. * identifier as other than the first character.
* <p> * <p>
* A character may be part of a Java identifier if any of the following * A character may be part of a Java identifier if any of the following
* are true: * conditions are true:
* <ul> * <ul>
* <li> it is a letter * <li> it is a letter
* <li> it is a currency symbol (such as {@code '$'}) * <li> it is a currency symbol (such as {@code '$'})
...@@ -6044,6 +6070,9 @@ class Character implements java.io.Serializable, Comparable<Character> { ...@@ -6044,6 +6070,9 @@ class Character implements java.io.Serializable, Comparable<Character> {
* {@code true} for the character * {@code true} for the character
* </ul> * </ul>
* *
* These conditions are tested against the character information from version
* 6.2 of the Unicode Standard.
*
* <p><b>Note:</b> This method cannot handle <a * <p><b>Note:</b> This method cannot handle <a
* href="#supplementary"> supplementary characters</a>. To support * href="#supplementary"> supplementary characters</a>. To support
* all Unicode characters, including supplementary characters, use * all Unicode characters, including supplementary characters, use
...@@ -6068,7 +6097,7 @@ class Character implements java.io.Serializable, Comparable<Character> { ...@@ -6068,7 +6097,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* identifier as other than the first character. * identifier as other than the first character.
* <p> * <p>
* A character may be part of a Java identifier if any of the following * A character may be part of a Java identifier if any of the following
* are true: * conditions are true:
* <ul> * <ul>
* <li> it is a letter * <li> it is a letter
* <li> it is a currency symbol (such as {@code '$'}) * <li> it is a currency symbol (such as {@code '$'})
...@@ -6079,9 +6108,12 @@ class Character implements java.io.Serializable, Comparable<Character> { ...@@ -6079,9 +6108,12 @@ class Character implements java.io.Serializable, Comparable<Character> {
* <li> it is a non-spacing mark * <li> it is a non-spacing mark
* <li> {@link #isIdentifierIgnorable(int) * <li> {@link #isIdentifierIgnorable(int)
* isIdentifierIgnorable(codePoint)} returns {@code true} for * isIdentifierIgnorable(codePoint)} returns {@code true} for
* the character * the code point
* </ul> * </ul>
* *
* 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. * @param codePoint the character (Unicode code point) to be tested.
* @return {@code true} if the character may be part of a * @return {@code true} if the character may be part of a
* Java identifier; {@code false} otherwise. * Java identifier; {@code false} otherwise.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册