changeset 50623:de1b9c4ce173 condy-folding

relocating and renaming interfaces (Type | Method | Field) Descriptor
author vromero
date Fri, 11 May 2018 07:45:45 -0700
parents 902051a97d9a
children 10d2bee4357d
files src/java.base/share/classes/java/lang/Class.java src/java.base/share/classes/java/lang/invoke/FieldTypeDescriptor.java src/java.base/share/classes/java/lang/invoke/MethodType.java src/java.base/share/classes/java/lang/invoke/MethodTypeDescriptor.java src/java.base/share/classes/java/lang/invoke/TypeDescriptor.java src/java.base/share/classes/java/lang/invoke/constant/ClassDesc.java src/java.base/share/classes/java/lang/invoke/constant/FieldDescriptor.java src/java.base/share/classes/java/lang/invoke/constant/MethodDescriptor.java src/java.base/share/classes/java/lang/invoke/constant/MethodTypeDesc.java src/java.base/share/classes/java/lang/invoke/constant/TypeDescriptor.java
diffstat 10 files changed, 156 insertions(+), 154 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/Class.java	Thu May 10 19:25:23 2018 -0700
+++ b/src/java.base/share/classes/java/lang/Class.java	Fri May 11 07:45:45 2018 -0700
@@ -28,7 +28,7 @@
 import java.lang.annotation.Annotation;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.constant.ClassDesc;
-import java.lang.invoke.constant.FieldDescriptor;
+import java.lang.invoke.FieldTypeDescriptor;
 import java.lang.module.ModuleReader;
 import java.lang.ref.SoftReference;
 import java.io.IOException;
@@ -135,7 +135,7 @@
                               GenericDeclaration,
                               Type,
                               AnnotatedElement,
-                              FieldDescriptor<Class<?>>,
+                              FieldTypeDescriptor<Class<?>>,
                               Constable<Class<T>> {
     private static final int ANNOTATION= 0x00002000;
     private static final int ENUM      = 0x00004000;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/java/lang/invoke/FieldTypeDescriptor.java	Fri May 11 07:45:45 2018 -0700
@@ -0,0 +1,35 @@
+package java.lang.invoke;
+
+/**
+ * Represents a field type descriptor, as per JVMS 4.3.2.
+ *
+ * @param <F> the class implementing {@linkplain FieldTypeDescriptor}
+ */
+public interface FieldTypeDescriptor<F extends FieldTypeDescriptor<F>> extends TypeDescriptor {
+    /**
+     * Does this field descriptor describe an array type?
+     * @return whether this field descriptor describes an array type
+     */
+    boolean isArray();
+
+    /**
+     * Does this field descriptor describe a primitive type?
+     * @return whether this field descriptor describes a primitive type
+     */
+    boolean isPrimitive();
+
+    /**
+     * If this field descriptor describes an array type, return
+     * a descriptor for its component type.
+     * @return the component type
+     * @throws IllegalStateException if this descriptor does not describe an array type
+     */
+    F componentType();
+
+    /**
+     * Return a descriptor for the array type whose component type is described by this
+     * descriptor
+     * @return the descriptor for the array type
+     */
+    F arrayType();
+}
--- a/src/java.base/share/classes/java/lang/invoke/MethodType.java	Thu May 10 19:25:23 2018 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/MethodType.java	Fri May 11 07:45:45 2018 -0700
@@ -28,7 +28,7 @@
 import jdk.internal.vm.annotation.Stable;
 import sun.invoke.util.Wrapper;
 
-import java.lang.invoke.constant.MethodDescriptor;
+import java.lang.invoke.MethodTypeDescriptor;
 import java.lang.invoke.constant.MethodTypeDesc;
 import java.lang.ref.WeakReference;
 import java.lang.ref.Reference;
@@ -102,7 +102,7 @@
 public final
 class MethodType
         implements Constable<MethodType>,
-                   MethodDescriptor<Class<?>, MethodType>,
+                   MethodTypeDescriptor<Class<?>, MethodType>,
                    java.io.Serializable {
     private static final long serialVersionUID = 292L;  // {rtype, {ptype...}}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/java/lang/invoke/MethodTypeDescriptor.java	Fri May 11 07:45:45 2018 -0700
@@ -0,0 +1,101 @@
+package java.lang.invoke;
+
+import java.util.List;
+
+/**
+ * Represents a method type descriptor, as per JVMS 4.3.3
+ *
+ * @param <F> the type representing field type descriptors
+ * @param <M> the class implementing {@linkplain MethodTypeDescriptor}
+ */
+public interface MethodTypeDescriptor<F extends FieldTypeDescriptor<F>, M extends MethodTypeDescriptor<F, M>>
+        extends TypeDescriptor {
+
+    /**
+     * Return the number of parameters in the method type
+     * @return the number of parameters
+     */
+    int parameterCount();
+
+    /**
+     * Return a field descriptor describing the requested parameter of the method type
+     * described by this descriptor
+     * @param i the index of the parameter
+     * @return a field descriptor for the requested parameter type
+     * @throws IndexOutOfBoundsException if the index is outside the half-open
+     * range {[0, parameterCount)}
+     */
+    F parameterType(int i);
+
+    /**
+     * Return a field descriptor describing the return type of the method type described
+     * by this descriptor
+     * @return a field descriptor for the return type
+     */
+    F returnType();
+
+    /**
+     * Return an array of field descriptors for the parameter types of the method type
+     * described by this descriptor
+     * @return field descriptors for the parameter types
+     */
+    F[] parameterArray();
+
+    /**
+     * Return a list of field descriptors for the parameter types of the method type
+     * described by this descriptor
+     * @return field descriptors for the parameter types
+     */
+    List<F> parameterList();
+
+    /**
+     * Return a method descriptor that is identical to this one, except that the return
+     * type has been changed to the specified type
+     *
+     * @param newReturn a field descriptor for the new return type
+     * @throws NullPointerException if any argument is {@code null}
+     * @return the new method descriptor
+     */
+    M changeReturnType(F newReturn);
+
+    /**
+     * Return a method descriptor that is identical to this one,
+     * except that a single parameter type has been changed to the specified type.
+     *
+     * @param index the index of the parameter to change
+     * @param paramType a field descriptor describing the new parameter type
+     * @return the new method descriptor
+     * @throws NullPointerException if any argument is {@code null}
+     * @throws IndexOutOfBoundsException if the index is outside the half-open
+     * range {[0, parameterCount)}
+     */
+    M changeParameterType(int index, F paramType);
+
+    /**
+     * Return a method descriptor that is identical to this one,
+     * except that a range of parameter types have been removed.
+     *
+     * @param start the index of the first parameter to remove
+     * @param end the index after the last parameter to remove
+     * @return the new method descriptor
+     * @throws IndexOutOfBoundsException if {@code start} is outside the half-open
+     * range {[0, parameterCount)}, or {@code end} is outside the closed range
+     * {@code [0, parameterCount]}
+     */
+    M dropParameterTypes(int start, int end);
+
+    /**
+     * Return a method descriptor that is identical to this one,
+     * except that a range of additional parameter types have been inserted.
+     *
+     * @param pos the index at which to insert the first inserted parameter
+     * @param paramTypes field descriptors describing the new parameter types
+     *                   to insert
+     * @return the new method descriptor
+     * @throws NullPointerException if any argument is {@code null}
+     * @throws IndexOutOfBoundsException if {@code pos} is outside the closed
+     * range {[0, parameterCount]}
+     */
+    @SuppressWarnings("unchecked")
+    M insertParameterTypes(int pos, F... paramTypes);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/java/lang/invoke/TypeDescriptor.java	Fri May 11 07:45:45 2018 -0700
@@ -0,0 +1,12 @@
+package java.lang.invoke;
+
+/**
+ * An entity that has a field or method type descriptor, as per JVMS 4.3.2 or 4.3.3.
+ */
+public interface TypeDescriptor {
+    /**
+     * Return the type descriptor for this instance, which may be a field or method type descriptor.
+     * @return the type descriptor
+     */
+    String descriptorString();
+}
--- a/src/java.base/share/classes/java/lang/invoke/constant/ClassDesc.java	Thu May 10 19:25:23 2018 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/constant/ClassDesc.java	Fri May 11 07:45:45 2018 -0700
@@ -25,6 +25,7 @@
 package java.lang.invoke.constant;
 
 import jdk.internal.lang.annotation.Foldable;
+import java.lang.invoke.FieldTypeDescriptor;
 
 import java.util.stream.Stream;
 
@@ -54,7 +55,7 @@
 public interface ClassDesc
         extends ConstantDesc<Class<?>>,
                 Constable<ConstantDesc<Class<?>>>,
-                FieldDescriptor<ClassDesc> {
+                FieldTypeDescriptor<ClassDesc> {
 
     /**
      * Create a {@linkplain ClassDesc} given a class name.
--- a/src/java.base/share/classes/java/lang/invoke/constant/FieldDescriptor.java	Thu May 10 19:25:23 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-package java.lang.invoke.constant;
-
-/**
- * Represents a field type descriptor, as per JVMS 4.3.2.
- *
- * @param <F> the class implementing {@linkplain FieldDescriptor}
- */
-public interface FieldDescriptor<F extends FieldDescriptor<F>> extends TypeDescriptor {
-    /**
-     * Does this field descriptor describe an array type?
-     * @return whether this field descriptor describes an array type
-     */
-    boolean isArray();
-
-    /**
-     * Does this field descriptor describe a primitive type?
-     * @return whether this field descriptor describes a primitive type
-     */
-    boolean isPrimitive();
-
-    /**
-     * If this field descriptor describes an array type, return
-     * a descriptor for its component type.
-     * @return the component type
-     * @throws IllegalStateException if this descriptor does not describe an array type
-     */
-    F componentType();
-
-    /**
-     * Return a descriptor for the array type whose component type is described by this
-     * descriptor
-     * @return the descriptor for the array type
-     */
-    F arrayType();
-}
--- a/src/java.base/share/classes/java/lang/invoke/constant/MethodDescriptor.java	Thu May 10 19:25:23 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-package java.lang.invoke.constant;
-
-import java.util.List;
-
-/**
- * Represents a method type descriptor, as per JVMS 4.3.3
- *
- * @param <F> the type representing field type descriptors
- * @param <M> the class implementing {@linkplain MethodDescriptor}
- */
-public interface MethodDescriptor<F extends FieldDescriptor<F>, M extends MethodDescriptor<F, M>>
-        extends TypeDescriptor {
-
-    /**
-     * Return the number of parameters in the method type
-     * @return the number of parameters
-     */
-    int parameterCount();
-
-    /**
-     * Return a field descriptor describing the requested parameter of the method type
-     * described by this descriptor
-     * @param i the index of the parameter
-     * @return a field descriptor for the requested parameter type
-     * @throws IndexOutOfBoundsException if the index is outside the half-open
-     * range {[0, parameterCount)}
-     */
-    F parameterType(int i);
-
-    /**
-     * Return a field descriptor describing the return type of the method type described
-     * by this descriptor
-     * @return a field descriptor for the return type
-     */
-    F returnType();
-
-    /**
-     * Return an array of field descriptors for the parameter types of the method type
-     * described by this descriptor
-     * @return field descriptors for the parameter types
-     */
-    F[] parameterArray();
-
-    /**
-     * Return a list of field descriptors for the parameter types of the method type
-     * described by this descriptor
-     * @return field descriptors for the parameter types
-     */
-    List<F> parameterList();
-
-    /**
-     * Return a method descriptor that is identical to this one, except that the return
-     * type has been changed to the specified type
-     *
-     * @param newReturn a field descriptor for the new return type
-     * @throws NullPointerException if any argument is {@code null}
-     * @return the new method descriptor
-     */
-    M changeReturnType(F newReturn);
-
-    /**
-     * Return a method descriptor that is identical to this one,
-     * except that a single parameter type has been changed to the specified type.
-     *
-     * @param index the index of the parameter to change
-     * @param paramType a field descriptor describing the new parameter type
-     * @return the new method descriptor
-     * @throws NullPointerException if any argument is {@code null}
-     * @throws IndexOutOfBoundsException if the index is outside the half-open
-     * range {[0, parameterCount)}
-     */
-    M changeParameterType(int index, F paramType);
-
-    /**
-     * Return a method descriptor that is identical to this one,
-     * except that a range of parameter types have been removed.
-     *
-     * @param start the index of the first parameter to remove
-     * @param end the index after the last parameter to remove
-     * @return the new method descriptor
-     * @throws IndexOutOfBoundsException if {@code start} is outside the half-open
-     * range {[0, parameterCount)}, or {@code end} is outside the closed range
-     * {@code [0, parameterCount]}
-     */
-    M dropParameterTypes(int start, int end);
-
-    /**
-     * Return a method descriptor that is identical to this one,
-     * except that a range of additional parameter types have been inserted.
-     *
-     * @param pos the index at which to insert the first inserted parameter
-     * @param paramTypes field descriptors describing the new parameter types
-     *                   to insert
-     * @return the new method descriptor
-     * @throws NullPointerException if any argument is {@code null}
-     * @throws IndexOutOfBoundsException if {@code pos} is outside the closed
-     * range {[0, parameterCount]}
-     */
-    @SuppressWarnings("unchecked")
-    M insertParameterTypes(int pos, F... paramTypes);
-}
--- a/src/java.base/share/classes/java/lang/invoke/constant/MethodTypeDesc.java	Thu May 10 19:25:23 2018 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/constant/MethodTypeDesc.java	Fri May 11 07:45:45 2018 -0700
@@ -27,6 +27,7 @@
 import jdk.internal.lang.annotation.Foldable;
 
 import java.lang.invoke.MethodType;
+import java.lang.invoke.MethodTypeDescriptor;
 import java.util.List;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -40,7 +41,7 @@
 public interface MethodTypeDesc
         extends ConstantDesc<MethodType>,
                 Constable<ConstantDesc<MethodType>>,
-                MethodDescriptor<ClassDesc, MethodTypeDesc> {
+                MethodTypeDescriptor<ClassDesc, MethodTypeDesc> {
     /**
      * Create a {@linkplain MethodTypeDesc} given a method descriptor string
      *
--- a/src/java.base/share/classes/java/lang/invoke/constant/TypeDescriptor.java	Thu May 10 19:25:23 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-package java.lang.invoke.constant;
-
-/**
- * An entity that has a field or method type descriptor, as per JVMS 4.3.2 or 4.3.3.
- */
-public interface TypeDescriptor {
-    /**
-     * Return the type descriptor for this instance, which may be a field or method type descriptor.
-     * @return the type descriptor
-     */
-    String descriptorString();
-}