1
1
/*
2
- * Copyright 2002-2011 the original author or authors.
2
+ * Copyright 2002-2013 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.
25
25
import java .util .List ;
26
26
import java .util .Map ;
27
27
28
- import org .springframework .util .Assert ;
29
28
import org .springframework .util .ClassUtils ;
30
29
import org .springframework .util .ReflectionUtils ;
31
30
@@ -91,7 +90,7 @@ public static Method findBridgedMethod(Method bridgeMethod) {
91
90
* Searches for the bridged method in the given candidates.
92
91
* @param candidateMethods the List of candidate Methods
93
92
* @param bridgeMethod the bridge method
94
- * @return the bridged method, or < code> null</code> if none found
93
+ * @return the bridged method, or {@ code null} if none found
95
94
*/
96
95
private static Method searchCandidates (List <Method > candidateMethods , Method bridgeMethod ) {
97
96
if (candidateMethods .isEmpty ()) {
@@ -114,7 +113,7 @@ else if (previousMethod != null) {
114
113
}
115
114
116
115
/**
117
- * Returns < code> true</code> if the supplied '< code> candidateMethod</code> ' can be
116
+ * Returns {@ code true} if the supplied '{@ code candidateMethod} ' can be
118
117
* consider a validate candidate for the {@link Method} that is {@link Method#isBridge() bridged}
119
118
* by the supplied {@link Method bridge Method}. This method performs inexpensive
120
119
* checks and can be used quickly filter for a set of possible matches.
@@ -145,7 +144,7 @@ static boolean isBridgeMethodFor(Method bridgeMethod, Method candidateMethod, Ma
145
144
private static Method findGenericDeclaration (Method bridgeMethod ) {
146
145
// Search parent types for method that has same signature as bridge.
147
146
Class superclass = bridgeMethod .getDeclaringClass ().getSuperclass ();
148
- while (!Object .class .equals (superclass )) {
147
+ while (superclass != null && !Object .class .equals (superclass )) {
149
148
Method method = searchForMatch (superclass , bridgeMethod );
150
149
if (method != null && !method .isBridge ()) {
151
150
return method ;
@@ -166,10 +165,10 @@ private static Method findGenericDeclaration(Method bridgeMethod) {
166
165
}
167
166
168
167
/**
169
- * Returns < code> true</code> if the {@link Type} signature of both the supplied
168
+ * Returns {@ code true} if the {@link Type} signature of both the supplied
170
169
* {@link Method#getGenericParameterTypes() generic Method} and concrete {@link Method}
171
170
* are equal after resolving all {@link TypeVariable TypeVariables} using the supplied
172
- * TypeVariable Map, otherwise returns < code> false</code> .
171
+ * TypeVariable Map, otherwise returns {@ code false} .
173
172
*/
174
173
private static boolean isResolvedTypeMatch (
175
174
Method genericMethod , Method candidateMethod , Map <TypeVariable , Type > typeVariableMap ) {
@@ -205,7 +204,7 @@ private static boolean isResolvedTypeMatch(
205
204
/**
206
205
* If the supplied {@link Class} has a declared {@link Method} whose signature matches
207
206
* that of the supplied {@link Method}, then this matching {@link Method} is returned,
208
- * otherwise < code> null</code> is returned.
207
+ * otherwise {@ code null} is returned.
209
208
*/
210
209
private static Method searchForMatch (Class type , Method bridgeMethod ) {
211
210
return ReflectionUtils .findMethod (type , bridgeMethod .getName (), bridgeMethod .getParameterTypes ());
@@ -219,8 +218,6 @@ private static Method searchForMatch(Class type, Method bridgeMethod) {
219
218
* @return whether signatures match as described
220
219
*/
221
220
public static boolean isVisibilityBridgeMethodPair (Method bridgeMethod , Method bridgedMethod ) {
222
- Assert .isTrue (bridgeMethod != null );
223
- Assert .isTrue (bridgedMethod != null );
224
221
if (bridgeMethod == bridgedMethod ) {
225
222
return true ;
226
223
}
0 commit comments