< prev index next >

src/java.base/share/classes/java/lang/constant/ClassDescImpl.java

Print this page
*** 29,14 ***
  import static java.lang.constant.ConstantUtils.*;
  import static java.util.Objects.requireNonNull;
  
  /**
   * A <a href="package-summary.html#nominal">nominal descriptor</a> for a class,
!  * interface, or array type.  A {@linkplain ReferenceClassDescImpl} corresponds to a
   * {@code Constant_Class_info} entry in the constant pool of a classfile.
   */
! final class ReferenceClassDescImpl implements ClassDesc {
      private final String descriptor;
  
      /**
       * Creates a {@linkplain ClassDesc} from a descriptor string for a class or
       * interface type or an array type.
--- 29,14 ---
  import static java.lang.constant.ConstantUtils.*;
  import static java.util.Objects.requireNonNull;
  
  /**
   * A <a href="package-summary.html#nominal">nominal descriptor</a> for a class,
!  * interface, or array type.  A {@linkplain ClassDescImpl} corresponds to a
   * {@code Constant_Class_info} entry in the constant pool of a classfile.
   */
! final class ClassDescImpl implements ClassDesc {
      private final String descriptor;
  
      /**
       * Creates a {@linkplain ClassDesc} from a descriptor string for a class or
       * interface type or an array type.

*** 44,11 ***
       * @param descriptor a field descriptor string for a class or interface type
       * @throws IllegalArgumentException if the descriptor string is not a valid
       * field descriptor string, or does not describe a class or interface type
       * @jvms 4.3.2 Field Descriptors
       */
!     ReferenceClassDescImpl(String descriptor) {
          requireNonNull(descriptor);
          int len = ConstantUtils.skipOverFieldSignature(descriptor, 0, descriptor.length(), false);
          if (len == 0 || len == 1
              || len != descriptor.length())
              throw new IllegalArgumentException(String.format("not a valid reference type descriptor: %s", descriptor));
--- 44,11 ---
       * @param descriptor a field descriptor string for a class or interface type
       * @throws IllegalArgumentException if the descriptor string is not a valid
       * field descriptor string, or does not describe a class or interface type
       * @jvms 4.3.2 Field Descriptors
       */
!     ClassDescImpl(String descriptor) {
          requireNonNull(descriptor);
          int len = ConstantUtils.skipOverFieldSignature(descriptor, 0, descriptor.length(), false);
          if (len == 0 || len == 1
              || len != descriptor.length())
              throw new IllegalArgumentException(String.format("not a valid reference type descriptor: %s", descriptor));

*** 86,12 ***
          // arrays, leaving primitive arrays the only ones without a final semicolon
          return descriptor.charAt(descriptor.length() - 1) != ';';
      }
  
      /**
!      * Returns {@code true} if this {@linkplain ReferenceClassDescImpl} is
!      * equal to another {@linkplain ReferenceClassDescImpl}.  Equality is
       * determined by the two class descriptors having equal class descriptor
       * strings.
       *
       * @param o the {@code ClassDesc} to compare to this
       *       {@code ClassDesc}
--- 86,12 ---
          // arrays, leaving primitive arrays the only ones without a final semicolon
          return descriptor.charAt(descriptor.length() - 1) != ';';
      }
  
      /**
!      * Returns {@code true} if this {@linkplain ClassDescImpl} is
!      * equal to another {@linkplain ClassDescImpl}.  Equality is
       * determined by the two class descriptors having equal class descriptor
       * strings.
       *
       * @param o the {@code ClassDesc} to compare to this
       *       {@code ClassDesc}
< prev index next >