Browse Source

BridgeMethodResolver properly resolves all declared interfaces

Issue: SPR-16288
pull/1610/merge
Juergen Hoeller 8 years ago
parent
commit
69c882cfbc
  1. 7
      spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java
  2. 16
      spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java

7
spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -192,7 +192,10 @@ public abstract class BridgeMethodResolver {
return method; return method;
} }
else { else {
return searchInterfaces(ifc.getInterfaces(), bridgeMethod); method = searchInterfaces(ifc.getInterfaces(), bridgeMethod);
if (method != null) {
return method;
}
} }
} }
return null; return null;

16
spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -782,7 +782,7 @@ public class BridgeMethodResolverTests {
} }
@SuppressWarnings({ "unused", "unchecked" }) @SuppressWarnings({"unused", "unchecked"})
public static abstract class GenericEventBroadcasterImpl<T extends Event> public static abstract class GenericEventBroadcasterImpl<T extends Event>
extends GenericBroadcasterImpl implements EventBroadcaster { extends GenericBroadcasterImpl implements EventBroadcaster {
@ -847,10 +847,10 @@ public class BridgeMethodResolverTests {
} }
@SuppressWarnings("unchecked") @SuppressWarnings({"serial", "unchecked"})
public static class MessageBroadcasterImpl extends public static class MessageBroadcasterImpl extends GenericEventBroadcasterImpl<MessageEvent>
GenericEventBroadcasterImpl<MessageEvent> implements Serializable, // implement an unrelated interface first (SPR-16288)
implements MessageBroadcaster { MessageBroadcaster {
public MessageBroadcasterImpl() { public MessageBroadcasterImpl() {
super(NewMessageEvent.class); super(NewMessageEvent.class);
@ -1005,8 +1005,8 @@ public class BridgeMethodResolverTests {
} }
public static class HibernateRepositoryRegistry extends public static class HibernateRepositoryRegistry
SettableRepositoryRegistry<GenericHibernateRepository<?, ?>> { extends SettableRepositoryRegistry<GenericHibernateRepository<?, ?>> {
@Override @Override
public void injectInto(GenericHibernateRepository<?, ?> rep) { public void injectInto(GenericHibernateRepository<?, ?> rep) {

Loading…
Cancel
Save