Spring codegen - fix equals and hashCode methods for byte array and binary (#8345)

* Spring codegen - fix equals and hashCode methods for byte array and binary

- they should be compared using Arrays.equals
- they're hash code generated using Arrays.hashCode

* Corrected checkstyle issues

* Revert changes for binary types
This commit is contained in:
Chris Coltsman
2021-01-28 06:04:03 +01:00
committed by GitHub
parent 0b2aa21f5d
commit a2a88cb8f0
21 changed files with 62 additions and 38 deletions

View File

@@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.UUID;
import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
@@ -379,7 +380,7 @@ public class FormatTest {
Objects.equals(this._float, formatTest._float) &&
Objects.equals(this._double, formatTest._double) &&
Objects.equals(this.string, formatTest.string) &&
Objects.equals(this._byte, formatTest._byte) &&
Arrays.equals(this._byte, formatTest._byte) &&
Objects.equals(this.binary, formatTest.binary) &&
Objects.equals(this.date, formatTest.date) &&
Objects.equals(this.dateTime, formatTest.dateTime) &&
@@ -390,7 +391,7 @@ public class FormatTest {
@Override
public int hashCode() {
return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password, bigDecimal);
return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal);
}
@Override