changeset 53745:9fdcbc01f6ab jep-334

renaming ClassDesc::inner to ::nested
author vromero
date Thu, 06 Dec 2018 11:42:42 -0500
parents 411969c7b5df
children e738d80f0d45
files src/java.base/share/classes/java/lang/constant/ClassDesc.java src/java.base/share/classes/java/lang/constant/ConstantDescs.java test/jdk/java/lang/constant/ClassDescTest.java test/jdk/java/lang/constant/CondyDescTest.java test/jdk/java/lang/constant/MethodHandleDescTest.java
diffstat 5 files changed, 36 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/constant/ClassDesc.java	Wed Dec 05 22:40:40 2018 -0500
+++ b/src/java.base/share/classes/java/lang/constant/ClassDesc.java	Thu Dec 06 11:42:42 2018 -0500
@@ -159,42 +159,42 @@
     }
 
     /**
-     * Returns a {@linkplain ClassDesc} for an inner class of the class or
+     * Returns a {@linkplain ClassDesc} for a nested class of the class or
      * interface type described by this {@linkplain ClassDesc}.
      *
-     * @param innerName the unqualified name of the inner class
-     * @return a {@linkplain ClassDesc} describing the inner class
+     * @param nestedName the unqualified name of the nested class
+     * @return a {@linkplain ClassDesc} describing the nested class
      * @throws NullPointerException if any argument is {@code null}
      * @throws IllegalStateException if this {@linkplain ClassDesc} does not
      * describe a class or interface type
-     * @throws IllegalArgumentException if the inner class name is invalid
+     * @throws IllegalArgumentException if the nested class name is invalid
      */
-    default ClassDesc inner(String innerName) {
-        validateMemberName(innerName);
+    default ClassDesc nested(String nestedName) {
+        validateMemberName(nestedName);
         if (!isClassOrInterface())
             throw new IllegalStateException("Outer class is not a class or interface type");
-        return ClassDesc.ofDescriptor(String.format("%s$%s;", dropLastChar(descriptorString()), innerName));
+        return ClassDesc.ofDescriptor(String.format("%s$%s;", dropLastChar(descriptorString()), nestedName));
     }
 
     /**
-     * Returns a {@linkplain ClassDesc} for an inner class of the class or
+     * Returns a {@linkplain ClassDesc} for a nested class of the class or
      * interface type described by this {@linkplain ClassDesc}.
      *
-     * @param firstInnerName the unqualified name of the first level of inner class
-     * @param moreInnerNames the unqualified name(s) of the remaining levels of
-     *                       inner class
-     * @return a {@linkplain ClassDesc} describing the inner class
+     * @param firstNestedName the unqualified name of the first level of nested class
+     * @param moreNestedNames the unqualified name(s) of the remaining levels of
+     *                       nested class
+     * @return a {@linkplain ClassDesc} describing the nested class
      * @throws NullPointerException if any argument is {@code null}
      * @throws IllegalStateException if this {@linkplain ClassDesc} does not
      * describe a class or interface type
-     * @throws IllegalArgumentException if the inner class name is invalid
+     * @throws IllegalArgumentException if the nested class name is invalid
      */
-    default ClassDesc inner(String firstInnerName, String... moreInnerNames) {
+    default ClassDesc nested(String firstNestedName, String... moreNestedNames) {
         if (!isClassOrInterface())
             throw new IllegalStateException("Outer class is not a class or interface type");
-        return moreInnerNames.length == 0
-               ? inner(firstInnerName)
-               : inner(firstInnerName + Stream.of(moreInnerNames).collect(joining("$", "$", "")));
+        return moreNestedNames.length == 0
+               ? nested(firstNestedName)
+               : nested(firstNestedName + Stream.of(moreNestedNames).collect(joining("$", "$", "")));
     }
 
     /**
--- a/src/java.base/share/classes/java/lang/constant/ConstantDescs.java	Wed Dec 05 22:40:40 2018 -0500
+++ b/src/java.base/share/classes/java/lang/constant/ConstantDescs.java	Thu Dec 06 11:42:42 2018 -0500
@@ -118,7 +118,7 @@
     public static final ClassDesc CD_MethodHandles = ClassDesc.of("java.lang.invoke.MethodHandles");
 
     /** {@link ClassDesc} representing {@link MethodHandles.Lookup} */
-    public static final ClassDesc CD_MethodHandles_Lookup = CD_MethodHandles.inner("Lookup");
+    public static final ClassDesc CD_MethodHandles_Lookup = CD_MethodHandles.nested("Lookup");
 
     /** {@link ClassDesc} representing {@link MethodHandle} */
     public static final ClassDesc CD_MethodHandle = ClassDesc.of("java.lang.invoke.MethodHandle");
@@ -148,7 +148,7 @@
     public static final ClassDesc CD_ClassDesc = ClassDesc.of("java.lang.constant.ClassDesc");
 
     /** {@link ClassDesc} representing {@link EnumDesc} */
-    public static final ClassDesc CD_EnumDesc = CD_Enum.inner("EnumDesc");
+    public static final ClassDesc CD_EnumDesc = CD_Enum.nested("EnumDesc");
 
     /** {@link ClassDesc} representing {@link MethodTypeDesc} */
     public static final ClassDesc CD_MethodTypeDesc = ClassDesc.of("java.lang.constant.MethodTypeDesc");
@@ -160,10 +160,10 @@
     public static final ClassDesc CD_DirectMethodHandleDesc = ClassDesc.of("java.lang.constant.DirectMethodHandleDesc");
 
     /** {@link ClassDesc} representing {@link VarHandleDesc} */
-    public static final ClassDesc CD_VarHandleDesc = CD_VarHandle.inner("VarHandleDesc");
+    public static final ClassDesc CD_VarHandleDesc = CD_VarHandle.nested("VarHandleDesc");
 
     /** {@link ClassDesc} representing {@link DirectMethodHandleDesc.Kind} */
-    public static final ClassDesc CD_MethodHandleDesc_Kind = CD_DirectMethodHandleDesc.inner("Kind");
+    public static final ClassDesc CD_MethodHandleDesc_Kind = CD_DirectMethodHandleDesc.nested("Kind");
 
     /** {@link ClassDesc} representing {@link DynamicConstantDesc} */
     public static final ClassDesc CD_DynamicConstantDesc = ClassDesc.of("java.lang.constant.DynamicConstantDesc");
--- a/test/jdk/java/lang/constant/ClassDescTest.java	Wed Dec 05 22:40:40 2018 -0500
+++ b/test/jdk/java/lang/constant/ClassDescTest.java	Thu Dec 06 11:42:42 2018 -0500
@@ -146,7 +146,7 @@
         }
 
         testClassDesc(ClassDesc.of("java.lang.String").arrayType(), String[].class);
-        testClassDesc(ClassDesc.of("java.util.Map").inner("Entry"), Map.Entry.class);
+        testClassDesc(ClassDesc.of("java.util.Map").nested("Entry"), Map.Entry.class);
 
         ClassDesc thisClassDesc = ClassDesc.ofDescriptor("LClassDescTest;");
         assertEquals(thisClassDesc, ClassDesc.of("", "ClassDescTest"));
@@ -157,10 +157,10 @@
 
     public void testPackageName() {
         assertEquals("com.foo", ClassDesc.of("com.foo.Bar").packageName());
-        assertEquals("com.foo", ClassDesc.of("com.foo.Bar").inner("Baz").packageName());
+        assertEquals("com.foo", ClassDesc.of("com.foo.Bar").nested("Baz").packageName());
         assertEquals("", ClassDesc.of("Bar").packageName());
-        assertEquals("", ClassDesc.of("Bar").inner("Baz").packageName());
-        assertEquals("", ClassDesc.of("Bar").inner("Baz", "Foo").packageName());
+        assertEquals("", ClassDesc.of("Bar").nested("Baz").packageName());
+        assertEquals("", ClassDesc.of("Bar").nested("Baz", "Foo").packageName());
 
         assertEquals("", ConstantDescs.CD_int.packageName());
         assertEquals("", ConstantDescs.CD_int.arrayType().packageName());
@@ -241,14 +241,14 @@
         }
 
         for (Primitives p : Primitives.values()) {
-            testBadInnerClasses(ClassDesc.ofDescriptor(p.descriptor), "any");
-            testBadInnerClasses(ClassDesc.ofDescriptor(p.descriptor), "any", "other");
+            testBadNestedClasses(ClassDesc.ofDescriptor(p.descriptor), "any");
+            testBadNestedClasses(ClassDesc.ofDescriptor(p.descriptor), "any", "other");
         }
     }
 
-    private void testBadInnerClasses(ClassDesc cr, String firstInnerName, String... moreInnerNames) {
+    private void testBadNestedClasses(ClassDesc cr, String firstNestedName, String... moreNestedNames) {
         try {
-            cr.inner(firstInnerName, moreInnerNames);
+            cr.nested(firstNestedName, moreNestedNames);
             fail("");
         } catch (IllegalStateException e) {
             // good
--- a/test/jdk/java/lang/constant/CondyDescTest.java	Wed Dec 05 22:40:40 2018 -0500
+++ b/test/jdk/java/lang/constant/CondyDescTest.java	Thu Dec 06 11:42:42 2018 -0500
@@ -115,7 +115,7 @@
     enum MyEnum { A, B, C }
 
     public void testEnumDesc() throws ReflectiveOperationException {
-        ClassDesc enumClass = ClassDesc.of("CondyDescTest").inner("MyEnum");
+        ClassDesc enumClass = ClassDesc.of("CondyDescTest").nested("MyEnum");
 
         testEnumDesc(EnumDesc.of(enumClass, "A"), MyEnum.A);
         testEnumDesc(EnumDesc.of(enumClass, "B"), MyEnum.B);
@@ -134,7 +134,7 @@
     }
 
     public void testVarHandles() throws ReflectiveOperationException {
-        ClassDesc testClass = ClassDesc.of("CondyDescTest").inner("MyClass");
+        ClassDesc testClass = ClassDesc.of("CondyDescTest").nested("MyClass");
         MyClass instance = new MyClass();
 
         // static varHandle
@@ -229,13 +229,13 @@
                      DynamicConstantDesc.ofNamed(ConstantDescs.BSM_PRIMITIVE_CLASS, "I", ConstantDescs.CD_Class, EMPTY_ARGS),
                      DynamicConstantDesc.ofCanonical(ConstantDescs.BSM_PRIMITIVE_CLASS, "I", ConstantDescs.CD_Class, EMPTY_ARGS));
 
-        ClassDesc enumClass = ClassDesc.of("CondyDescTest").inner("MyEnum");
+        ClassDesc enumClass = ClassDesc.of("CondyDescTest").nested("MyEnum");
         assertLifted(EnumDesc.of(enumClass, "A"),
                      DynamicConstantDesc.ofNamed(ConstantDescs.BSM_ENUM_CONSTANT, "A", enumClass, EMPTY_ARGS),
                      DynamicConstantDesc.<MyEnum>ofCanonical(ConstantDescs.BSM_ENUM_CONSTANT, "A", enumClass, EMPTY_ARGS));
 
 
-        ClassDesc testClass = ClassDesc.of("CondyDescTest").inner("MyClass");
+        ClassDesc testClass = ClassDesc.of("CondyDescTest").nested("MyClass");
 
         assertLifted(VarHandleDesc.ofStaticField(testClass, "sf", CD_int),
                      DynamicConstantDesc.ofNamed(ConstantDescs.BSM_VARHANDLE_STATIC_FIELD, "sf", CD_VarHandle, new ConstantDesc[] {testClass, CD_int }),
--- a/test/jdk/java/lang/constant/MethodHandleDescTest.java	Wed Dec 05 22:40:40 2018 -0500
+++ b/test/jdk/java/lang/constant/MethodHandleDescTest.java	Thu Dec 06 11:42:42 2018 -0500
@@ -68,9 +68,9 @@
 @Test
 public class MethodHandleDescTest extends SymbolicDescTest {
     private static ClassDesc helperHolderClass = ClassDesc.of("TestHelpers");
-    private static ClassDesc testClass = helperHolderClass.inner("TestClass");
-    private static ClassDesc testInterface = helperHolderClass.inner("TestInterface");
-    private static ClassDesc testSuperclass = helperHolderClass.inner("TestSuperclass");
+    private static ClassDesc testClass = helperHolderClass.nested("TestClass");
+    private static ClassDesc testInterface = helperHolderClass.nested("TestInterface");
+    private static ClassDesc testSuperclass = helperHolderClass.nested("TestSuperclass");
 
 
     private static void assertMHEquals(MethodHandle a, MethodHandle b) {