mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8287908: Use non-cloning reflection methods where acceptable
Reviewed-by: rriggs
This commit is contained in:
parent
0c61bf109f
commit
9ef6c0925a
4 changed files with 9 additions and 9 deletions
|
@ -330,7 +330,7 @@ public abstract sealed class Executable extends AccessibleObject
|
||||||
} else {
|
} else {
|
||||||
final boolean realParamData = hasRealParameterData();
|
final boolean realParamData = hasRealParameterData();
|
||||||
final Type[] genericParamTypes = getGenericParameterTypes();
|
final Type[] genericParamTypes = getGenericParameterTypes();
|
||||||
final Type[] nonGenericParamTypes = getParameterTypes();
|
final Type[] nonGenericParamTypes = getSharedParameterTypes();
|
||||||
// If we have real parameter data, then we use the
|
// If we have real parameter data, then we use the
|
||||||
// synthetic and mandate flags to our advantage.
|
// synthetic and mandate flags to our advantage.
|
||||||
if (realParamData) {
|
if (realParamData) {
|
||||||
|
@ -357,7 +357,7 @@ public abstract sealed class Executable extends AccessibleObject
|
||||||
// synthetic/mandated, thus, no way to match up the
|
// synthetic/mandated, thus, no way to match up the
|
||||||
// indexes.
|
// indexes.
|
||||||
return genericParamTypes.length == nonGenericParamTypes.length ?
|
return genericParamTypes.length == nonGenericParamTypes.length ?
|
||||||
genericParamTypes : nonGenericParamTypes;
|
genericParamTypes : getParameterTypes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -234,7 +234,7 @@ public final class Parameter implements AnnotatedElement {
|
||||||
public Class<?> getType() {
|
public Class<?> getType() {
|
||||||
Class<?> tmp = parameterClassCache;
|
Class<?> tmp = parameterClassCache;
|
||||||
if (null == tmp) {
|
if (null == tmp) {
|
||||||
tmp = executable.getParameterTypes()[index];
|
tmp = executable.getSharedParameterTypes()[index];
|
||||||
parameterClassCache = tmp;
|
parameterClassCache = tmp;
|
||||||
}
|
}
|
||||||
return tmp;
|
return tmp;
|
||||||
|
|
|
@ -1256,7 +1256,7 @@ public class Proxy implements java.io.Serializable {
|
||||||
// check if this method is the resolved method if referenced from
|
// check if this method is the resolved method if referenced from
|
||||||
// this proxy interface (i.e. this method is not implemented
|
// this proxy interface (i.e. this method is not implemented
|
||||||
// by any other superinterface)
|
// by any other superinterface)
|
||||||
Method m = proxyIntf.getMethod(method.getName(), method.getParameterTypes());
|
Method m = proxyIntf.getMethod(method.getName(), method.getSharedParameterTypes());
|
||||||
if (m.getDeclaringClass() == declaringClass) {
|
if (m.getDeclaringClass() == declaringClass) {
|
||||||
return proxyIntf;
|
return proxyIntf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -522,7 +522,7 @@ final class ProxyGenerator extends ClassWriter {
|
||||||
*/
|
*/
|
||||||
private void addProxyMethod(Method m, Class<?> fromClass) {
|
private void addProxyMethod(Method m, Class<?> fromClass) {
|
||||||
Class<?> returnType = m.getReturnType();
|
Class<?> returnType = m.getReturnType();
|
||||||
Class<?>[] exceptionTypes = m.getExceptionTypes();
|
Class<?>[] exceptionTypes = m.getSharedExceptionTypes();
|
||||||
|
|
||||||
String sig = m.toShortSignature();
|
String sig = m.toShortSignature();
|
||||||
List<ProxyMethod> sigmethods = proxyMethods.computeIfAbsent(sig,
|
List<ProxyMethod> sigmethods = proxyMethods.computeIfAbsent(sig,
|
||||||
|
@ -544,7 +544,7 @@ final class ProxyGenerator extends ClassWriter {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sigmethods.add(new ProxyMethod(m, sig, m.getParameterTypes(), returnType,
|
sigmethods.add(new ProxyMethod(m, sig, m.getSharedParameterTypes(), returnType,
|
||||||
exceptionTypes, fromClass,
|
exceptionTypes, fromClass,
|
||||||
"m" + proxyMethodCount++));
|
"m" + proxyMethodCount++));
|
||||||
}
|
}
|
||||||
|
@ -717,8 +717,8 @@ final class ProxyGenerator extends ClassWriter {
|
||||||
*/
|
*/
|
||||||
private ProxyMethod(Method method, String methodFieldName) {
|
private ProxyMethod(Method method, String methodFieldName) {
|
||||||
this(method, method.toShortSignature(),
|
this(method, method.toShortSignature(),
|
||||||
method.getParameterTypes(), method.getReturnType(),
|
method.getSharedParameterTypes(), method.getReturnType(),
|
||||||
method.getExceptionTypes(), method.getDeclaringClass(), methodFieldName);
|
method.getSharedExceptionTypes(), method.getDeclaringClass(), methodFieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue