From eab1a3dc6beb351d7302192f8fec51640596dc4e Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Fri, 23 Feb 2024 12:50:31 +0100 Subject: [PATCH] Fix BridgeMethodResolverTests.isBridgeMethodFor() in Eclipse IDE --- .../core/BridgeMethodResolverTests.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 b2bfb433296..5e254f45d5c 100644 --- a/spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java +++ b/spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java @@ -30,6 +30,7 @@ import java.util.concurrent.Delayed; import org.junit.jupiter.api.Test; +import org.springframework.core.testfixture.ide.IdeUtils; import org.springframework.util.ReflectionUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -120,7 +121,14 @@ class BridgeMethodResolverTests { void isBridgeMethodFor() throws Exception { Method bridged = MyBar.class.getDeclaredMethod("someMethod", String.class, Object.class); Method other = MyBar.class.getDeclaredMethod("someMethod", Integer.class, Object.class); - Method bridge = MyBar.class.getDeclaredMethod("someMethod", Object.class, Object.class); + Method bridge; + + if (IdeUtils.runningInEclipse()) { + bridge = InterBar.class.getDeclaredMethod("someMethod", Object.class, Object.class); + } + else { + bridge = MyBar.class.getDeclaredMethod("someMethod", Object.class, Object.class); + } assertThat(BridgeMethodResolver.isBridgeMethodFor(bridge, bridged, MyBar.class)).as("Should be bridge method").isTrue(); assertThat(BridgeMethodResolver.isBridgeMethodFor(bridge, other, MyBar.class)).as("Should not be bridge method").isFalse();