Optimize sun.invoke.util.BytecodeDescriptor.unparse

Mandy Chung mandy.chung at oracle.com
Thu Aug 20 18:53:33 UTC 2020


On 8/20/20 11:01 AM, Christoph Dreis wrote:
> =========== PATCH ===============
> --- a/src/java.base/share/classes/sun/invoke/util/BytecodeDescriptor.java       Thu Aug 13 09:33:28 2020 -0700
> +++ b/src/java.base/share/classes/sun/invoke/util/BytecodeDescriptor.java       Thu Aug 20 19:44:57 2020 +0200
> @@ -110,9 +110,7 @@
>           } else if (type == int.class) {
>               return "I";
>           }
> -        StringBuilder sb = new StringBuilder();
> -        unparseSig(type, sb);
> -        return sb.toString();
> +        return type.descriptorString();
>       }
>
> What do you think?
>

This looks fine.   FYI.  unparseSig(Class<?> t, StringBuilder sb) was 
already changed to call `Class::descriptorString` by JDK-8238358.   It's 
redundant for unparse(Class<?> t) to call unparseSig.

Mandy


More information about the core-libs-dev mailing list