File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
src/java.base/share/classes/java/lang Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -1722,7 +1722,12 @@ private String getCanonicalName0() {
17221722 String enclosingName = enclosingClass .getCanonicalName ();
17231723 if (enclosingName == null )
17241724 return ReflectionData .NULL_SENTINEL ;
1725- return enclosingName + "." + getSimpleName ();
1725+ String simpleName = getSimpleName ();
1726+ return new StringBuilder (enclosingName .length () + simpleName .length () + 1 )
1727+ .append (enclosingName )
1728+ .append ('.' )
1729+ .append (simpleName )
1730+ .toString ();
17261731 }
17271732 }
17281733
@@ -4365,10 +4370,20 @@ public String descriptorString() {
43654370 } else if (isHidden ()) {
43664371 String name = getName ();
43674372 int index = name .indexOf ('/' );
4368- return "L" + name .substring (0 , index ).replace ('.' , '/' )
4369- + "." + name .substring (index +1 ) + ";" ;
4373+ return new StringBuilder (name .length () + 2 )
4374+ .append ('L' )
4375+ .append (name .substring (0 , index ).replace ('.' , '/' ))
4376+ .append ('.' )
4377+ .append (name , index + 1 , name .length ())
4378+ .append (';' )
4379+ .toString ();
43704380 } else {
4371- return "L" + getName ().replace ('.' , '/' ) + ";" ;
4381+ String name = getName ().replace ('.' , '/' );
4382+ return new StringBuilder (name .length () + 2 )
4383+ .append ('L' )
4384+ .append (name )
4385+ .append (';' )
4386+ .toString ();
43724387 }
43734388 }
43744389
You can’t perform that action at this time.
0 commit comments