Polishing

This commit is contained in:
Sam Brannen
2023-01-27 11:18:25 +01:00
parent 6a6a35a0b9
commit 556863d401

View File

@@ -926,13 +926,12 @@ class MergedAnnotationsTests {
assertThat(MergedAnnotations.from(method).get(Order.class).getDistance()).isEqualTo(-1);
assertThat(MergedAnnotations.from(method, SearchStrategy.TYPE_HIERARCHY).get(
Order.class).getDistance()).isEqualTo(0);
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 assertion if the test is currently executing within the Eclipse IDE.
// does not support this [2]. Thus, we effectively ignore the following
// assertion if the test is currently executing within the Eclipse IDE.
// [1] https://bugs.openjdk.java.net/browse/JDK-6695379
// [2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=495396
if (!runningInEclipse) {