+ if (bySchemaTree instanceof RuntimeType) {
+ final var tmp = (RuntimeType) bySchemaTree;
+ return qname.equals(tmp.statement().argument()) ? tmp : null;
+ }
+
+ final var tmp = (RuntimeType[]) bySchemaTree;
+ @SuppressFBWarnings(value = "SE_COMPARATOR_SHOULD_BE_SERIALIZABLE",
+ justification = "https://github.com/spotbugs/spotbugs/issues/1985")
+ final int offset = Arrays.binarySearch(tmp, null, (o1, o2) -> {
+ // We make assumptions about how Arrays.binarySearch() is implemented: o2 is expected to be the provided
+ // key -- which is null. This helps CHA by not introducing a fake RuntimeType class and the
+ // corresponding instanceof checks.
+ verify(o2 == null, "Unexpected key %s", o2);
+ return extractQName(o1).compareTo(qname);
+ });
+ return offset < 0 ? null : tmp[offset];