--- a/src/java.base/share/classes/java/text/ChoiceFormat.java Thu Oct 17 20:27:44 2019 +0100
+++ b/src/java.base/share/classes/java/text/ChoiceFormat.java Thu Oct 17 20:53:35 2019 +0100
@@ -44,8 +44,8 @@
import java.util.Arrays;
/**
- * A <code>ChoiceFormat</code> allows you to attach a format to a range of numbers.
- * It is generally used in a <code>MessageFormat</code> for handling plurals.
+ * A {@code ChoiceFormat} allows you to attach a format to a range of numbers.
+ * It is generally used in a {@code MessageFormat} for handling plurals.
* The choice is specified with an ascending list of doubles, where each item
* specifies a half-open interval up to the next item:
* <blockquote>
@@ -60,15 +60,15 @@
*
* <p>
* <strong>Note:</strong>
- * <code>ChoiceFormat</code> differs from the other <code>Format</code>
- * classes in that you create a <code>ChoiceFormat</code> object with a
- * constructor (not with a <code>getInstance</code> style factory
- * method). The factory methods aren't necessary because <code>ChoiceFormat</code>
+ * {@code ChoiceFormat} differs from the other {@code Format}
+ * classes in that you create a {@code ChoiceFormat} object with a
+ * constructor (not with a {@code getInstance} style factory
+ * method). The factory methods aren't necessary because {@code ChoiceFormat}
* doesn't require any complex setup for a given locale. In fact,
- * <code>ChoiceFormat</code> doesn't implement any locale specific behavior.
+ * {@code ChoiceFormat} doesn't implement any locale specific behavior.
*
* <p>
- * When creating a <code>ChoiceFormat</code>, you must specify an array of formats
+ * When creating a {@code ChoiceFormat}, you must specify an array of formats
* and an array of limits. The length of these arrays must be the same.
* For example,
* <ul>
@@ -78,7 +78,7 @@
* <li>
* <em>limits</em> = {0, 1, ChoiceFormat.nextDouble(1)}<br>
* <em>formats</em> = {"no files", "one file", "many files"}<br>
- * (<code>nextDouble</code> can be used to get the next higher double, to
+ * ({@code nextDouble} can be used to get the next higher double, to
* make the half-open interval.)
* </ul>
*
@@ -168,12 +168,13 @@
public class ChoiceFormat extends NumberFormat {
// Proclaim serial compatibility with 1.1 FCS
+ @java.io.Serial
private static final long serialVersionUID = 1795184449645032964L;
/**
* Sets the pattern.
* @param newPattern See the class description.
- * @exception NullPointerException if {@code newPattern}
+ * @throws NullPointerException if {@code newPattern}
* is {@code null}
*/
public void applyPattern(String newPattern) {
@@ -312,7 +313,7 @@
* Constructs with limits and corresponding formats based on the pattern.
*
* @param newPattern the new pattern string
- * @exception NullPointerException if {@code newPattern} is
+ * @throws NullPointerException if {@code newPattern} is
* {@code null}
* @see #applyPattern
*/
@@ -325,7 +326,7 @@
*
* @param limits limits in ascending order
* @param formats corresponding format strings
- * @exception NullPointerException if {@code limits} or {@code formats}
+ * @throws NullPointerException if {@code limits} or {@code formats}
* is {@code null}
* @see #setChoices
*/
@@ -346,7 +347,7 @@
* When formatting with object Y,
* if the object is a NumberFormat, then ((NumberFormat) Y).format(X)
* is called. Otherwise Y.toString() is called.
- * @exception NullPointerException if {@code limits} or
+ * @throws NullPointerException if {@code limits} or
* {@code formats} is {@code null}
*/
public void setChoices(double[] limits, String formats[]) {
@@ -380,7 +381,7 @@
/**
* Specialization of format. This method really calls
- * <code>format(double, StringBuffer, FieldPosition)</code>
+ * {@code format(double, StringBuffer, FieldPosition)}
* thus the range of longs that are supported is only equal to
* the range that can be stored by double. This will never be
* a practical limitation.
@@ -395,7 +396,7 @@
* @param number number to be formatted and substituted.
* @param toAppendTo where text is appended.
* @param status ignore no useful status is returned.
- * @exception NullPointerException if {@code toAppendTo}
+ * @throws NullPointerException if {@code toAppendTo}
* is {@code null}
*/
public StringBuffer format(double number, StringBuffer toAppendTo,
@@ -425,7 +426,7 @@
* status.index is unchanged and status.errorIndex is set to the
* first index of the character that caused the parse to fail.
* @return A Number representing the value of the number parsed.
- * @exception NullPointerException if {@code status} is {@code null}
+ * @throws NullPointerException if {@code status} is {@code null}
* or if {@code text} is {@code null} and the list of
* choice strings is not empty.
*/
@@ -528,6 +529,7 @@
* to maintain class invariants.
* @throws InvalidObjectException if the objects read from the stream is invalid.
*/
+ @java.io.Serial
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
if (choiceLimits.length != choiceFormats.length) {
@@ -540,16 +542,16 @@
/**
* A list of lower bounds for the choices. The formatter will return
- * <code>choiceFormats[i]</code> if the number being formatted is greater than or equal to
- * <code>choiceLimits[i]</code> and less than <code>choiceLimits[i+1]</code>.
+ * {@code choiceFormats[i]} if the number being formatted is greater than or equal to
+ * {@code choiceLimits[i]} and less than {@code choiceLimits[i+1]}.
* @serial
*/
private double[] choiceLimits;
/**
* A list of choice strings. The formatter will return
- * <code>choiceFormats[i]</code> if the number being formatted is greater than or equal to
- * <code>choiceLimits[i]</code> and less than <code>choiceLimits[i+1]</code>.
+ * {@code choiceFormats[i]} if the number being formatted is greater than or equal to
+ * {@code choiceLimits[i]} and less than {@code choiceLimits[i+1]}.
* @serial
*/
private String[] choiceFormats;