1
1
/*
2
- * Copyright 2002-2017 the original author or authors.
2
+ * Copyright 2002-2018 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -201,15 +201,13 @@ public Object getProxy(ClassLoader classLoader) {
201
201
return createProxyClassAndInstance (enhancer , callbacks );
202
202
}
203
203
catch (CodeGenerationException ex ) {
204
- throw new AopConfigException ("Could not generate CGLIB subclass of class [" +
205
- this .advised .getTargetClass () + "]: " +
206
- "Common causes of this problem include using a final class or a non-visible class" ,
204
+ throw new AopConfigException ("Could not generate CGLIB subclass of " + this .advised .getTargetClass () +
205
+ ": Common causes of this problem include using a final class or a non-visible class" ,
207
206
ex );
208
207
}
209
208
catch (IllegalArgumentException ex ) {
210
- throw new AopConfigException ("Could not generate CGLIB subclass of class [" +
211
- this .advised .getTargetClass () + "]: " +
212
- "Common causes of this problem include using a final class or a non-visible class" ,
209
+ throw new AopConfigException ("Could not generate CGLIB subclass of " + this .advised .getTargetClass () +
210
+ ": Common causes of this problem include using a final class or a non-visible class" ,
213
211
ex );
214
212
}
215
213
catch (Throwable ex ) {
@@ -259,7 +257,7 @@ private void doValidateClass(Class<?> proxySuperClass, ClassLoader proxyClassLoa
259
257
Method [] methods = proxySuperClass .getDeclaredMethods ();
260
258
for (Method method : methods ) {
261
259
int mod = method .getModifiers ();
262
- if (!Modifier .isStatic (mod )) {
260
+ if (!Modifier .isStatic (mod ) && ! Modifier . isPrivate ( mod ) ) {
263
261
if (Modifier .isFinal (mod )) {
264
262
if (implementsInterface (method , ifcs )) {
265
263
logger .warn ("Unable to proxy interface-implementing method [" + method + "] because " +
@@ -269,7 +267,7 @@ private void doValidateClass(Class<?> proxySuperClass, ClassLoader proxyClassLoa
269
267
"Calls to this method will NOT be routed to the target instance and " +
270
268
"might lead to NPEs against uninitialized fields in the proxy instance." );
271
269
}
272
- else if (!Modifier .isPublic (mod ) && !Modifier .isProtected (mod ) && ! Modifier . isPrivate ( mod ) &&
270
+ else if (!Modifier .isPublic (mod ) && !Modifier .isProtected (mod ) &&
273
271
proxyClassLoader != null && proxySuperClass .getClassLoader () != proxyClassLoader ) {
274
272
logger .info ("Method [" + method + "] is package-visible across different ClassLoaders " +
275
273
"and cannot get proxied via CGLIB: Declare this method as public or protected " +
0 commit comments