Align with StackWalker use in MergedAnnotationsTests.getFromMethodWithBridgeMethod()

This commit is contained in:
Sam Brannen 2023-10-15 15:54:51 +02:00
parent 0eb92c1267
commit 8e5f39b439
1 changed files with 2 additions and 4 deletions

View File

@ -24,7 +24,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -160,9 +159,8 @@ class AnnotationUtilsTests {
assertThat(getAnnotation(bridgeMethod, Order.class)).isNull();
assertThat(findAnnotation(bridgeMethod, Order.class)).isNotNull();
boolean runningInEclipse = Arrays.stream(new Exception().getStackTrace())
.anyMatch(element -> element.getClassName().startsWith("org.eclipse.jdt"));
boolean runningInEclipse = StackWalker.getInstance().walk(stream ->
stream.anyMatch(stackFrame -> stackFrame.getClassName().startsWith("org.eclipse.jdt")));
// As of JDK 8, invoking getAnnotation() on a bridge method actually finds an
// annotation on its 'bridged' method [1]; however, the Eclipse compiler will not
// support this until Eclipse 4.9 [2]. Thus, we effectively ignore the following