fixup! Fix issues of template

* For Java code, provide a `equals` method as the behavior of Java == is
  different from C++
* For Python code, fix a has_feature bug
This commit is contained in:
Xiaoge Su 2023-07-03 14:04:20 -07:00
parent 1465b60c02
commit d835c0244e
2 changed files with 9 additions and 1 deletions

View File

@ -35,6 +35,14 @@ class ProtocolVersion implements Comparable<ProtocolVersion> {
return protocolVersion;
}
@Override
public boolean equals(Object ob) {
if (!(ob instanceof ProtocolVersion)) {
return false;
}
return this.protocolVersion == ((ProtocolVersion) ob).protocolVersion;
}
public boolean isSupported() {
return supportedVersions.contains(this);
}

View File

@ -66,7 +66,7 @@ class ProtocolVersion:
@property
def has_{{ feature | feature_name_transformer }}(self) -> bool:
return self > ProtocolVersion({{ version | encode_version }})
return self >= ProtocolVersion({{ version | encode_version }})
@staticmethod
def with_{{ feature | feature_name_transformer }}() -> "ProtocolVersion":