Browse Source

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
pull/1/head
Juergen Hoeller 16 years ago
parent
commit
f0981ecdb1
  1. 18
      org.springframework.core/src/main/java/org/springframework/core/BridgeMethodResolver.java

18
org.springframework.core/src/main/java/org/springframework/core/BridgeMethodResolver.java

@ -53,7 +53,9 @@ public abstract class BridgeMethodResolver { @@ -53,7 +53,9 @@ public abstract class BridgeMethodResolver {
* <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.
* 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) {
if (bridgeMethod == null || !bridgeMethod.isBridge()) {
@ -72,12 +74,16 @@ public abstract class BridgeMethodResolver { @@ -72,12 +74,16 @@ public abstract class BridgeMethodResolver {
return candidateMethods.get(0);
}
// Search for candidate match.
Method result = searchCandidates(candidateMethods, bridgeMethod);
if (result == null) {
throw new IllegalStateException(
"Unable to locate bridged method for bridge method '" + bridgeMethod + "'");
Method bridgedMethod = searchCandidates(candidateMethods, bridgeMethod);
if (bridgedMethod != null) {
// Bridged method found...
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…
Cancel
Save