Browse Source

Prevent warning about final private methods in CglibAopProxy

Issue: SPR-15820
pull/28402/head
Sebastien Deleuze 8 years ago
parent
commit
1e07468d20
  1. 4
      spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java

4
spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java

@ -257,7 +257,7 @@ class CglibAopProxy implements AopProxy, Serializable {
Method[] methods = proxySuperClass.getDeclaredMethods(); Method[] methods = proxySuperClass.getDeclaredMethods();
for (Method method : methods) { for (Method method : methods) {
int mod = method.getModifiers(); int mod = method.getModifiers();
if (!Modifier.isStatic(mod)) { if (!Modifier.isStatic(mod) && !Modifier.isPrivate(mod)) {
if (Modifier.isFinal(mod)) { if (Modifier.isFinal(mod)) {
if (implementsInterface(method, ifcs)) { if (implementsInterface(method, ifcs)) {
logger.warn("Unable to proxy interface-implementing method [" + method + "] because " + logger.warn("Unable to proxy interface-implementing method [" + method + "] because " +
@ -267,7 +267,7 @@ class CglibAopProxy implements AopProxy, Serializable {
"Calls to this method will NOT be routed to the target instance and " + "Calls to this method will NOT be routed to the target instance and " +
"might lead to NPEs against uninitialized fields in the proxy instance."); "might lead to NPEs against uninitialized fields in the proxy instance.");
} }
else if (!Modifier.isPublic(mod) && !Modifier.isProtected(mod) && !Modifier.isPrivate(mod) && else if (!Modifier.isPublic(mod) && !Modifier.isProtected(mod) &&
proxyClassLoader != null && proxySuperClass.getClassLoader() != proxyClassLoader) { proxyClassLoader != null && proxySuperClass.getClassLoader() != proxyClassLoader) {
logger.info("Method [" + method + "] is package-visible across different ClassLoaders " + logger.info("Method [" + method + "] is package-visible across different ClassLoaders " +
"and cannot get proxied via CGLIB: Declare this method as public or protected " + "and cannot get proxied via CGLIB: Declare this method as public or protected " +

Loading…
Cancel
Save