Avoid bridge resolution for method from unrelated class hierarchy
Closes gh-32087
This commit is contained in:
@@ -38,6 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
* @author Yanming Zhou
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
class BridgeMethodResolverTests {
|
||||
@@ -97,6 +98,13 @@ class BridgeMethodResolverTests {
|
||||
assertThat(bridgedMethod.getParameterTypes()[0]).isEqualTo(Date.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void findBridgedMethodFromOriginalMethodNotInHierarchy() throws Exception {
|
||||
Method originalMethod = Adder.class.getMethod("add", Object.class);
|
||||
Method mostSpecificMethod = BridgeMethodResolver.getMostSpecificMethod(originalMethod, FakeAdder.class);
|
||||
assertThat(mostSpecificMethod).isSameAs(originalMethod);
|
||||
}
|
||||
|
||||
@Test
|
||||
void isBridgeMethodFor() throws Exception {
|
||||
Method bridged = MyBar.class.getDeclaredMethod("someMethod", String.class, Object.class);
|
||||
@@ -406,6 +414,13 @@ class BridgeMethodResolverTests {
|
||||
}
|
||||
|
||||
|
||||
public static class FakeAdder {
|
||||
|
||||
public void add(Date date) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class Enclosing<T> {
|
||||
|
||||
public class Enclosed<S> {
|
||||
|
||||
Reference in New Issue
Block a user