< prev index next >

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

Print this page
*** 55,11 ***
   */
  public sealed interface ClassDesc
          extends ConstantDesc,
                  TypeDescriptor.OfField<ClassDesc>
          permits PrimitiveClassDescImpl,
!                 ReferenceClassDescImpl {
  
      /**
       * Returns a {@linkplain ClassDesc} for a class or interface type,
       * given the name of the class or interface, such as {@code "java.lang.String"}.
       * (To create a descriptor for an array type, either use {@link #ofDescriptor(String)}
--- 55,11 ---
   */
  public sealed interface ClassDesc
          extends ConstantDesc,
                  TypeDescriptor.OfField<ClassDesc>
          permits PrimitiveClassDescImpl,
!                 ClassDescImpl {
  
      /**
       * Returns a {@linkplain ClassDesc} for a class or interface type,
       * given the name of the class or interface, such as {@code "java.lang.String"}.
       * (To create a descriptor for an array type, either use {@link #ofDescriptor(String)}

*** 167,11 ***
                      "Cannot create an array type descriptor with more than " +
                      ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS + " dimensions");
          }
          return (descriptor.length() == 1)
                 ? new PrimitiveClassDescImpl(descriptor)
!                : new ReferenceClassDescImpl(descriptor);
      }
  
      /**
       * Returns a {@linkplain ClassDesc} for an array type whose component type
       * is described by this {@linkplain ClassDesc}.
--- 167,11 ---
                      "Cannot create an array type descriptor with more than " +
                      ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS + " dimensions");
          }
          return (descriptor.length() == 1)
                 ? new PrimitiveClassDescImpl(descriptor)
!                : new ClassDescImpl(descriptor);
      }
  
      /**
       * Returns a {@linkplain ClassDesc} for an array type whose component type
       * is described by this {@linkplain ClassDesc}.

*** 293,11 ***
       * Returns whether this {@linkplain ClassDesc} describes a class or interface type.
       *
       * @return whether this {@linkplain ClassDesc} describes a class or interface type
       */
      default boolean isClassOrInterface() {
!         return descriptorString().startsWith("L");
      }
  
      /**
       * Returns the component type of this {@linkplain ClassDesc}, if it describes
       * an array type, or {@code null} otherwise.
--- 293,11 ---
       * Returns whether this {@linkplain ClassDesc} describes a class or interface type.
       *
       * @return whether this {@linkplain ClassDesc} describes a class or interface type
       */
      default boolean isClassOrInterface() {
!         return descriptorString().startsWith("L") || descriptorString().startsWith("Q");
      }
  
      /**
       * Returns the component type of this {@linkplain ClassDesc}, if it describes
       * an array type, or {@code null} otherwise.
< prev index next >