changeset 52969:77ec0ada61d8 condy-folding

Automatic merge with jep-334
author mcimadamore
date Tue, 06 Nov 2018 21:00:52 +0100
parents 7842dfb9712e 1f389923436d
children c5905f5d6d45
files src/java.base/share/classes/java/lang/Class.java src/java.base/share/classes/java/lang/Double.java src/java.base/share/classes/java/lang/Enum.java src/java.base/share/classes/java/lang/Float.java src/java.base/share/classes/java/lang/Integer.java src/java.base/share/classes/java/lang/Long.java src/java.base/share/classes/java/lang/String.java src/java.base/share/classes/java/lang/invoke/MethodHandle.java src/java.base/share/classes/java/lang/invoke/MethodType.java src/java.base/share/classes/java/lang/invoke/VarHandle.java
diffstat 11 files changed, 76 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/Class.java	Mon Nov 05 12:39:01 2018 -0500
+++ b/src/java.base/share/classes/java/lang/Class.java	Tue Nov 06 21:00:52 2018 +0100
@@ -4033,6 +4033,7 @@
      *
      * @return the type descriptor representation
      * @jvms 4.3.2 Field Descriptors
+     * @since 12
      */
     @Override
     public String descriptorString() {
@@ -4046,16 +4047,39 @@
         }
     }
 
+    /**
+     * Returns the component type of this {@code Class}, if it describes
+     * an array type, or {@code null} otherwise.
+     *
+     * @return a {@code Class} describing the component type, or {@code null}
+     * if this descriptor does not describe an array type
+     * @since 12
+     */
     @Override
     public Class<?> componentType() {
         return isArray() ? componentType : null;
     }
 
+    /**
+     * Create a {@code Class} for an array type whose component type
+     * is described by this {@linkplain ClassDesc}.
+     *
+     * @return a {@code ClassDesc} describing the array type
+     * @since 12
+     */
     @Override
     public Class<?> arrayType() {
         return Array.newInstance(this, 0).getClass();
     }
 
+    /**
+     * Return a nominal descriptor for this instance, if one can be
+     * constructed, or an empty {@link Optional} if one cannot be.
+     *
+     * @return An {@link Optional} containing the resulting nominal descriptor,
+     * or an empty {@link Optional} if one cannot be constructed.
+     * @since 12
+     */
     @Override
     public Optional<ClassDesc> describeConstable() {
         return Optional.of(ClassDesc.ofDescriptor(descriptorString()));
--- a/src/java.base/share/classes/java/lang/Double.java	Mon Nov 05 12:39:01 2018 -0500
+++ b/src/java.base/share/classes/java/lang/Double.java	Tue Nov 06 21:00:52 2018 +0100
@@ -1081,6 +1081,7 @@
      * itself.
      *
      * @return an {@link Optional} describing the {@linkplain Double} instance
+     * @since 12
      */
     @Override
     public Optional<Double> describeConstable() {
@@ -1093,6 +1094,7 @@
      *
      * @param lookup ignored
      * @return the {@linkplain Double} instance
+     * @since 12
      */
     @Override
     public Double resolveConstantDesc(MethodHandles.Lookup lookup) {
--- a/src/java.base/share/classes/java/lang/Enum.java	Mon Nov 05 12:39:01 2018 -0500
+++ b/src/java.base/share/classes/java/lang/Enum.java	Tue Nov 06 21:00:52 2018 +0100
@@ -210,6 +210,14 @@
         return (zuper == Enum.class) ? (Class<E>)clazz : (Class<E>)zuper;
     }
 
+    /**
+     * Return an enum descriptor {@code EnumDesc} for this instance, if one can be
+     * constructed, or an empty {@link Optional} if one cannot be.
+     *
+     * @return An {@link Optional} containing the resulting nominal descriptor,
+     * or an empty {@link Optional} if one cannot be constructed.
+     * @since 12
+     */
     @Override
     public final Optional<EnumDesc<E>> describeConstable() {
         return getDeclaringClass()
@@ -305,6 +313,7 @@
          * @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,
--- a/src/java.base/share/classes/java/lang/Float.java	Mon Nov 05 12:39:01 2018 -0500
+++ b/src/java.base/share/classes/java/lang/Float.java	Tue Nov 06 21:00:52 2018 +0100
@@ -993,6 +993,7 @@
      * itself.
      *
      * @return an {@link Optional} describing the {@linkplain Float} instance
+     * @since 12
      */
     @Override
     public Optional<Float> describeConstable() {
@@ -1005,6 +1006,7 @@
      *
      * @param lookup ignored
      * @return the {@linkplain Float} instance
+     * @since 12
      */
     @Override
     public Float resolveConstantDesc(MethodHandles.Lookup lookup) {
--- a/src/java.base/share/classes/java/lang/Integer.java	Mon Nov 05 12:39:01 2018 -0500
+++ b/src/java.base/share/classes/java/lang/Integer.java	Tue Nov 06 21:00:52 2018 +0100
@@ -1836,6 +1836,7 @@
      * itself.
      *
      * @return an {@link Optional} describing the {@linkplain Integer} instance
+     * @since 12
      */
     @Override
     public Optional<Integer> describeConstable() {
@@ -1848,6 +1849,7 @@
      *
      * @param lookup ignored
      * @return the {@linkplain Integer} instance
+     * @since 12
      */
     @Override
     public Integer resolveConstantDesc(MethodHandles.Lookup lookup) {
--- a/src/java.base/share/classes/java/lang/Long.java	Mon Nov 05 12:39:01 2018 -0500
+++ b/src/java.base/share/classes/java/lang/Long.java	Tue Nov 06 21:00:52 2018 +0100
@@ -1958,6 +1958,7 @@
      * itself.
      *
      * @return an {@link Optional} describing the {@linkplain Long} instance
+     * @since 12
      */
     @Override
     public Optional<Long> describeConstable() {
@@ -1970,6 +1971,7 @@
      *
      * @param lookup ignored
      * @return the {@linkplain Long} instance
+     * @since 12
      */
     @Override
     public Long resolveConstantDesc(MethodHandles.Lookup lookup) {
--- a/src/java.base/share/classes/java/lang/String.java	Mon Nov 05 12:39:01 2018 -0500
+++ b/src/java.base/share/classes/java/lang/String.java	Tue Nov 06 21:00:52 2018 +0100
@@ -3527,6 +3527,7 @@
      * itself.
      *
      * @return an {@link Optional} describing the {@linkplain String} instance
+     * @since 12
      */
     @Override
     public Optional<String> describeConstable() {
@@ -3539,6 +3540,7 @@
      *
      * @param lookup ignored
      * @return the {@linkplain String} instance
+     * @since 12
      */
     @Override
     public String resolveConstantDesc(MethodHandles.Lookup lookup) {
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Mon Nov 05 12:39:01 2018 -0500
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java	Tue Nov 06 21:00:52 2018 +0100
@@ -1520,6 +1520,14 @@
         return bindArgumentL(0, x);
     }
 
+    /**
+     * Return a nominal descriptor for this instance, if one can be
+     * constructed, or an empty {@link Optional} if one cannot be.
+     *
+     * @return An {@link Optional} containing the resulting nominal descriptor,
+     * or an empty {@link Optional} if one cannot be constructed.
+     * @since 12
+     */
     @Override
     public Optional<? extends ConstantDesc> describeConstable() {
         MethodHandleInfo info;
--- a/src/java.base/share/classes/java/lang/invoke/MethodType.java	Mon Nov 05 12:39:01 2018 -0500
+++ b/src/java.base/share/classes/java/lang/invoke/MethodType.java	Tue Nov 06 21:00:52 2018 +0100
@@ -1187,6 +1187,13 @@
         return desc;
     }
 
+    /**
+     * Return a field type descriptor string for this type, as per JVMS 4.3.2
+     *
+     * @return the descriptor string
+     * @jvms 4.3.2 Field Descriptors
+     * @since 12
+     */
     @Override
     public String descriptorString() {
         return toMethodDescriptorString();
@@ -1196,6 +1203,14 @@
         return BytecodeDescriptor.unparse(cls);
     }
 
+    /**
+     * Return a nominal descriptor for this instance, if one can be
+     * constructed, or an empty {@link Optional} if one cannot be.
+     *
+     * @return An {@link Optional} containing the resulting nominal descriptor,
+     * or an empty {@link Optional} if one cannot be constructed.
+     * @since 12
+     */
     @Override
     public Optional<MethodTypeDesc> describeConstable() {
         try {
--- a/src/java.base/share/classes/java/lang/invoke/TypeDescriptor.java	Mon Nov 05 12:39:01 2018 -0500
+++ b/src/java.base/share/classes/java/lang/invoke/TypeDescriptor.java	Tue Nov 06 21:00:52 2018 +0100
@@ -46,6 +46,7 @@
      *
      * @param <F> the class implementing {@linkplain TypeDescriptor.OfField}
      * @jvms 4.3.2 Field Descriptors
+     * @since 12
      */
     interface OfField<F extends TypeDescriptor.OfField<F>> extends TypeDescriptor {
         /**
@@ -83,6 +84,7 @@
      * @param <F> the type representing field type descriptors
      * @param <M> the class implementing {@linkplain TypeDescriptor.OfMethod}
      * @jvms 4.3.3 Method Descriptors
+     * @since 12
      */
     interface OfMethod<F extends TypeDescriptor.OfField<F>, M extends TypeDescriptor.OfMethod<F, M>>
             extends TypeDescriptor {
--- a/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Mon Nov 05 12:39:01 2018 -0500
+++ b/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Tue Nov 06 21:00:52 2018 +0100
@@ -1984,6 +1984,14 @@
         }
     }
 
+    /**
+     * Return a nominal descriptor for this instance, if one can be
+     * constructed, or an empty {@link Optional} if one cannot be.
+     *
+     * @return An {@link Optional} containing the resulting nominal descriptor,
+     * or an empty {@link Optional} if one cannot be constructed.
+     * @since 12
+     */
     @Override
     public Optional<VarHandleDesc> describeConstable() {
         // partial function for field and array only