remove forbidden API

This commit is contained in:
Simon Willnauer 2016-11-14 15:30:07 +01:00
parent bdc942fa72
commit 7d4bde8e00
1 changed files with 3 additions and 1 deletions

View File

@ -19,6 +19,7 @@
package org.elasticsearch; package org.elasticsearch;
import org.apache.lucene.util.MathUtil;
import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.SuppressForbidden;
@ -316,7 +317,8 @@ public class Version {
public boolean isCompatible(Version version) { public boolean isCompatible(Version version) {
boolean compatible = onOrAfter(version.minimumCompatibilityVersion()) boolean compatible = onOrAfter(version.minimumCompatibilityVersion())
&& version.onOrAfter(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; return compatible;
} }