< prev index next >

src/java.base/share/classes/java/lang/Enum.java

Print this page

        

@@ -23,17 +23,20 @@
  * questions.
  */
 
 package java.lang;
 
+import jdk.internal.lang.annotation.Foldable;
+
 import java.io.IOException;
 import java.io.InvalidObjectException;
 import java.io.ObjectInputStream;
 import java.io.ObjectStreamException;
 import java.io.Serializable;
 import java.lang.constant.ClassDesc;
 import java.lang.constant.Constable;
+import java.lang.constant.ConstantDesc;
 import java.lang.constant.ConstantDescs;
 import java.lang.constant.DynamicConstantDesc;
 import java.lang.invoke.MethodHandles;
 import java.util.Optional;
 

@@ -314,10 +317,11 @@
          * @return the nominal descriptor
          * @throws NullPointerException if any argument is null
          * @jvms 4.2.2 Unqualified Names
          * @since 12
          */
+        @Foldable
         public static<E extends Enum<E>> EnumDesc<E> of(ClassDesc enumClass,
                                                         String constantName) {
             return new EnumDesc<>(enumClass, constantName);
         }
 

@@ -330,7 +334,12 @@
 
         @Override
         public String toString() {
             return String.format("EnumDesc[%s.%s]", constantType().displayName(), constantName());
         }
+
+        @Override
+        public Optional<? extends ConstantDesc> describeConstable() {
+            return Optional.empty();
+        }
     }
 }
< prev index next >