diff --git a/src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java b/src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java index 6c82a6ecb6f..2e56d03c6ad 100644 --- a/src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java +++ b/src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java @@ -508,8 +508,7 @@ final class ProxyGenerator { Class[] exceptionTypes = m.getSharedExceptionTypes(); String sig = m.toShortSignature(); - List sigmethods = proxyMethods.computeIfAbsent(sig, - _ -> new ArrayList<>(3)); + List sigmethods = proxyMethodsFor(sig); for (ProxyMethod pm : sigmethods) { if (returnType == pm.returnType) { /* @@ -531,16 +530,17 @@ final class ProxyGenerator { exceptionTypes, fromClass, "m" + proxyMethodCount++)); } + private List proxyMethodsFor(String sig) { + return proxyMethods.computeIfAbsent(sig, _ -> new ArrayList<>(3)); + } + /** * Add an existing ProxyMethod (hashcode, equals, toString). * * @param pm an existing ProxyMethod */ private void addProxyMethod(ProxyMethod pm) { - String sig = pm.shortSignature; - List sigmethods = proxyMethods.computeIfAbsent(sig, - _ -> new ArrayList<>(3)); - sigmethods.add(pm); + proxyMethodsFor(pm.shortSignature).add(pm); } /**