< prev index next >

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

Print this page
@@ -55,11 +55,11 @@
   */
  public sealed interface ClassDesc
          extends ConstantDesc,
                  TypeDescriptor.OfField<ClassDesc>
          permits PrimitiveClassDescImpl,
-                 ReferenceClassDescImpl {
+                 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 +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);
+                : new ClassDescImpl(descriptor);
      }
  
      /**
       * Returns a {@linkplain ClassDesc} for an array type whose component type
       * is described by this {@linkplain ClassDesc}.

@@ -293,11 +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");
+         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 >