diff --git a/contrib/regex/src/java/org/apache/lucene/search/regex/JakartaRegexpCapabilities.java b/contrib/regex/src/java/org/apache/lucene/search/regex/JakartaRegexpCapabilities.java index d32554825d3..0808b5db63e 100644 --- a/contrib/regex/src/java/org/apache/lucene/search/regex/JakartaRegexpCapabilities.java +++ b/contrib/regex/src/java/org/apache/lucene/search/regex/JakartaRegexpCapabilities.java @@ -18,4 +18,19 @@ public class JakartaRegexpCapabilities implements RegexCapabilities { char[] prefix = RegexpTunnel.getPrefix(regexp); return prefix == null ? null : new String(prefix); } + + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + final JakartaRegexpCapabilities that = (JakartaRegexpCapabilities) o; + + if (regexp != null ? !regexp.equals(that.regexp) : that.regexp != null) return false; + + return true; + } + + public int hashCode() { + return (regexp != null ? regexp.hashCode() : 0); + } } diff --git a/contrib/regex/src/java/org/apache/lucene/search/regex/JavaUtilRegexCapabilities.java b/contrib/regex/src/java/org/apache/lucene/search/regex/JavaUtilRegexCapabilities.java index 90720b55ab9..6245c1b488f 100644 --- a/contrib/regex/src/java/org/apache/lucene/search/regex/JavaUtilRegexCapabilities.java +++ b/contrib/regex/src/java/org/apache/lucene/search/regex/JavaUtilRegexCapabilities.java @@ -16,4 +16,19 @@ public class JavaUtilRegexCapabilities implements RegexCapabilities { public String prefix() { return null; } + + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + final JavaUtilRegexCapabilities that = (JavaUtilRegexCapabilities) o; + + if (pattern != null ? !pattern.equals(that.pattern) : that.pattern != null) return false; + + return true; + } + + public int hashCode() { + return (pattern != null ? pattern.hashCode() : 0); + } }