Skip to content

Commit 8e5f39b

Browse files
committed
Align with StackWalker use in MergedAnnotationsTests.getFromMethodWithBridgeMethod()
1 parent 0eb92c1 commit 8e5f39b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.lang.annotation.RetentionPolicy;
2525
import java.lang.annotation.Target;
2626
import java.lang.reflect.Method;
27-
import java.util.Arrays;
2827
import java.util.Collections;
2928
import java.util.List;
3029
import java.util.Map;
@@ -160,9 +159,8 @@ void findMethodAnnotationOnBridgeMethod() throws Exception {
160159
assertThat(getAnnotation(bridgeMethod, Order.class)).isNull();
161160
assertThat(findAnnotation(bridgeMethod, Order.class)).isNotNull();
162161

163-
boolean runningInEclipse = Arrays.stream(new Exception().getStackTrace())
164-
.anyMatch(element -> element.getClassName().startsWith("org.eclipse.jdt"));
165-
162+
boolean runningInEclipse = StackWalker.getInstance().walk(stream ->
163+
stream.anyMatch(stackFrame -> stackFrame.getClassName().startsWith("org.eclipse.jdt")));
166164
// As of JDK 8, invoking getAnnotation() on a bridge method actually finds an
167165
// annotation on its 'bridged' method [1]; however, the Eclipse compiler will not
168166
// support this until Eclipse 4.9 [2]. Thus, we effectively ignore the following

0 commit comments

Comments
 (0)