changeset 54510:896ddba45177

8217339: ClassCircularityError loading NumberFormatProvider Reviewed-by: naoto, mchung
author rriggs
date Wed, 23 Jan 2019 09:57:31 -0500
parents c96f9aa1f3d8
children edba42d2370f
files src/java.base/share/classes/java/lang/constant/ClassDesc.java
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/constant/ClassDesc.java	Wed Jan 23 13:16:16 2019 +0000
+++ b/src/java.base/share/classes/java/lang/constant/ClassDesc.java	Wed Jan 23 09:57:31 2019 -0500
@@ -101,10 +101,8 @@
             return of(className);
         }
         validateMemberName(requireNonNull(className), false);
-        return ofDescriptor(String.format("L%s%s%s;",
-                                          binaryToInternal(packageName),
-                                          (packageName.length() > 0 ? "/" : ""),
-                                          className));
+        return ofDescriptor("L" + binaryToInternal(packageName) +
+                (packageName.length() > 0 ? "/" : "") + className + ";");
     }
 
     /**
@@ -134,12 +132,14 @@
     static ClassDesc ofDescriptor(String descriptor) {
         requireNonNull(descriptor);
         if (descriptor.isEmpty()) {
-            throw new IllegalArgumentException(String.format("not a valid reference type descriptor: %s", descriptor));
+            throw new IllegalArgumentException(
+                    "not a valid reference type descriptor: " + descriptor);
         }
         int depth = ConstantUtils.arrayDepth(descriptor);
         if (depth > ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS) {
-            throw new IllegalArgumentException(String.format("Cannot create an array type descriptor with more than %d dimensions",
-                    ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS));
+            throw new IllegalArgumentException(
+                    "Cannot create an array type descriptor with more than " +
+                    ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS + " dimensions");
         }
         return (descriptor.length() == 1)
                ? new PrimitiveClassDescImpl(descriptor)
@@ -157,8 +157,9 @@
     default ClassDesc arrayType() {
         int depth = ConstantUtils.arrayDepth(descriptorString());
         if (depth >= ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS) {
-            throw new IllegalStateException(String.format("Cannot create an array type descriptor with more than %d dimensions",
-                    ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS));
+            throw new IllegalStateException(
+                    "Cannot create an array type descriptor with more than " +
+                    ConstantUtils.MAX_ARRAY_TYPE_DESC_DIMENSIONS + " dimensions");
         }
         return arrayType(1);
     }
@@ -201,7 +202,7 @@
         validateMemberName(nestedName, false);
         if (!isClassOrInterface())
             throw new IllegalStateException("Outer class is not a class or interface type");
-        return ClassDesc.ofDescriptor(String.format("%s$%s;", dropLastChar(descriptorString()), nestedName));
+        return ClassDesc.ofDescriptor(dropLastChar(descriptorString()) + "$" + nestedName + ";");
     }
 
     /**