Skip to content

Commit 69c882c

Browse files
committed
BridgeMethodResolver properly resolves all declared interfaces
Issue: SPR-16288
1 parent 64af3a0 commit 69c882c

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -192,7 +192,10 @@ private static Method searchInterfaces(Class<?>[] interfaces, Method bridgeMetho
192192
return method;
193193
}
194194
else {
195-
return searchInterfaces(ifc.getInterfaces(), bridgeMethod);
195+
method = searchInterfaces(ifc.getInterfaces(), bridgeMethod);
196+
if (method != null) {
197+
return method;
198+
}
196199
}
197200
}
198201
return null;

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -782,7 +782,7 @@ public static class GenericBroadcasterImpl implements Broadcaster {
782782
}
783783

784784

785-
@SuppressWarnings({ "unused", "unchecked" })
785+
@SuppressWarnings({"unused", "unchecked"})
786786
public static abstract class GenericEventBroadcasterImpl<T extends Event>
787787
extends GenericBroadcasterImpl implements EventBroadcaster {
788788

@@ -847,10 +847,10 @@ public static class ModifiedMessageEvent extends MessageEvent {
847847
}
848848

849849

850-
@SuppressWarnings("unchecked")
851-
public static class MessageBroadcasterImpl extends
852-
GenericEventBroadcasterImpl<MessageEvent>
853-
implements MessageBroadcaster {
850+
@SuppressWarnings({"serial", "unchecked"})
851+
public static class MessageBroadcasterImpl extends GenericEventBroadcasterImpl<MessageEvent>
852+
implements Serializable, // implement an unrelated interface first (SPR-16288)
853+
MessageBroadcaster {
854854

855855
public MessageBroadcasterImpl() {
856856
super(NewMessageEvent.class);
@@ -1005,8 +1005,8 @@ public void delete(Collection<T> entities) {
10051005
}
10061006

10071007

1008-
public static class HibernateRepositoryRegistry extends
1009-
SettableRepositoryRegistry<GenericHibernateRepository<?, ?>> {
1008+
public static class HibernateRepositoryRegistry
1009+
extends SettableRepositoryRegistry<GenericHibernateRepository<?, ?>> {
10101010

10111011
@Override
10121012
public void injectInto(GenericHibernateRepository<?, ?> rep) {

0 commit comments

Comments
 (0)