leniently fall back to the passed-in method if a bridge method couldn't be resolved (for Groovy 1.7 compatibility)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2509 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
parent
6deff08db2
commit
f0981ecdb1
|
|
@ -53,7 +53,9 @@ public abstract class BridgeMethodResolver {
|
||||||
* <p>It is safe to call this method passing in a non-bridge {@link Method} instance.
|
* <p>It is safe to call this method passing in a non-bridge {@link Method} instance.
|
||||||
* In such a case, the supplied {@link Method} instance is returned directly to the caller.
|
* In such a case, the supplied {@link Method} instance is returned directly to the caller.
|
||||||
* Callers are <strong>not</strong> required to check for bridging before calling this method.
|
* Callers are <strong>not</strong> required to check for bridging before calling this method.
|
||||||
* @throws IllegalStateException if no bridged {@link Method} can be found
|
* @param bridgeMethod the method to introspect
|
||||||
|
* @return the original method (either the bridged method or the passed-in method
|
||||||
|
* if no more specific one could be found)
|
||||||
*/
|
*/
|
||||||
public static Method findBridgedMethod(Method bridgeMethod) {
|
public static Method findBridgedMethod(Method bridgeMethod) {
|
||||||
if (bridgeMethod == null || !bridgeMethod.isBridge()) {
|
if (bridgeMethod == null || !bridgeMethod.isBridge()) {
|
||||||
|
|
@ -72,12 +74,16 @@ public abstract class BridgeMethodResolver {
|
||||||
return candidateMethods.get(0);
|
return candidateMethods.get(0);
|
||||||
}
|
}
|
||||||
// Search for candidate match.
|
// Search for candidate match.
|
||||||
Method result = searchCandidates(candidateMethods, bridgeMethod);
|
Method bridgedMethod = searchCandidates(candidateMethods, bridgeMethod);
|
||||||
if (result == null) {
|
if (bridgedMethod != null) {
|
||||||
throw new IllegalStateException(
|
// Bridged method found...
|
||||||
"Unable to locate bridged method for bridge method '" + bridgeMethod + "'");
|
return bridgedMethod;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// A bridge method was passed in but we couldn't find the bridged method.
|
||||||
|
// Let's proceed with the passed-in method and hope for the best...
|
||||||
|
return bridgeMethod;
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue