Summary
Make MethodTypeDesc::descriptorString
an abstract method and no longer provides the default implementation.
Problem
The implementation of MethodTypeDesc::descriptorString
needs lazy cache for better performance and done in MethodTypeDescImpl
class. The default implementation of MethodTypeDesc::descriptorString
is redundant since MethodTypeDescImpl
is the only implementation class of MethodTypeDesc
sealed interface.
Solution
Move the implementation of descriptorString
into MethodTypeDescImpl,
and make MethodTypeDesc::descriptorString
abstract.
Specification
@@ -195,13 +195,7 @@ public sealed interface MethodTypeDesc
* @return the method type descriptor string
* @jvms 4.3.3 Method Descriptors
*/
- default String descriptorString() {
- return String.format("(%s)%s",
- Stream.of(parameterArray())
- .map(ClassDesc::descriptorString)
- .collect(Collectors.joining()),
- returnType().descriptorString());
- }
+ String descriptorString();
/**
* Returns a human-readable descriptor for this method type, using the
- csr of
-
JDK-8309413 Improve the performance of MethodTypeDesc::descriptorString
- Resolved