diff --git a/spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java b/spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java index 0427317d179..45bd0de4860 100644 --- a/spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java +++ b/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"); * you may not use this file except in compliance with the License. @@ -192,7 +192,10 @@ public abstract class BridgeMethodResolver { return method; } else { - return searchInterfaces(ifc.getInterfaces(), bridgeMethod); + method = searchInterfaces(ifc.getInterfaces(), bridgeMethod); + if (method != null) { + return method; + } } } return null; diff --git a/spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java b/spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java index d465840817e..cd42cc81365 100644 --- a/spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java +++ b/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"); * 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 extends GenericBroadcasterImpl implements EventBroadcaster { @@ -847,10 +847,10 @@ public class BridgeMethodResolverTests { } - @SuppressWarnings("unchecked") - public static class MessageBroadcasterImpl extends - GenericEventBroadcasterImpl - implements MessageBroadcaster { + @SuppressWarnings({"serial", "unchecked"}) + public static class MessageBroadcasterImpl extends GenericEventBroadcasterImpl + implements Serializable, // implement an unrelated interface first (SPR-16288) + MessageBroadcaster { public MessageBroadcasterImpl() { super(NewMessageEvent.class); @@ -1005,8 +1005,8 @@ public class BridgeMethodResolverTests { } - public static class HibernateRepositoryRegistry extends - SettableRepositoryRegistry> { + public static class HibernateRepositoryRegistry + extends SettableRepositoryRegistry> { @Override public void injectInto(GenericHibernateRepository rep) {