From 7d4bde8e001078f4cfa2ad33ca8b124152ea9c26 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Mon, 14 Nov 2016 15:30:07 +0100 Subject: [PATCH] remove forbidden API --- core/src/main/java/org/elasticsearch/Version.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/elasticsearch/Version.java b/core/src/main/java/org/elasticsearch/Version.java index b31a981e966..2d61fb8194a 100644 --- a/core/src/main/java/org/elasticsearch/Version.java +++ b/core/src/main/java/org/elasticsearch/Version.java @@ -19,6 +19,7 @@ package org.elasticsearch; +import org.apache.lucene.util.MathUtil; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.Strings; import org.elasticsearch.common.SuppressForbidden; @@ -316,7 +317,8 @@ public class Version { public boolean isCompatible(Version version) { boolean compatible = onOrAfter(version.minimumCompatibilityVersion()) && version.onOrAfter(minimumCompatibilityVersion()); - assert compatible == false || Math.abs(major - version.major) <= 1; + + assert compatible == false || Math.max(major, version.major) - Math.min(major, version.major) <= 1; return compatible; }