Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8264610

Number.{byteValue, shortValue} spec should use @implSpec

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 17
    • core-libs
    • None
    • minimal
    • Minor structuring improvement to the spec.
    • Java API
    • SE

      Summary

      Update the byteValue and shortValue methods of the abstract class java.lang.Number to use @implSpec tags.

      Problem

      The implementation of "default" methods in interfaces and abstract classes are best captured in @implSpec tags. The byteValue and shortValue methods would benefit from those tags.

      Solution

      Change existing implementation requirements to @implSpec tags.

      Specification

      --- a/src/java.base/share/classes/java/lang/Number.java
      +++ b/src/java.base/share/classes/java/lang/Number.java
      @@ -93,7 +93,8 @@ public abstract class Number implements java.io.Serializable {
           /**
            * Returns the value of the specified number as a {@code byte}.
            *
      -     * <p>This implementation returns the result of {@link #intValue} cast
      +     * @implSpec
      +     * The default implementation returns the result of {@link #intValue} cast
            * to a {@code byte}.
            *
            * @return  the numeric value represented by this object after conversion
      @@ -107,7 +108,8 @@ public abstract class Number implements java.io.Serializable {
           /**
            * Returns the value of the specified number as a {@code short}.
            *
      -     * <p>This implementation returns the result of {@link #intValue} cast
      +     * @implSpec
      +     * The default implementation returns the result of {@link #intValue} cast
            * to a {@code short}.
            *
            * @return  the numeric value represented by this object after conversion

            darcy Joe Darcy
            darcy Joe Darcy
            Brian Burkhalter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: