Fix checkstyle method order issues

Fix checkstyle issues with method ordering following the
spring-javaformat upgrade.

See gh-13932
This commit is contained in:
Phillip Webb
2018-07-27 15:45:33 +01:00
parent e6a68b39a3
commit 63b609827e
58 changed files with 606 additions and 606 deletions

View File

@@ -124,20 +124,6 @@ final class AsciiBytes {
return new AsciiBytes(this.bytes, this.offset + beginIndex, length);
}
@Override
public String toString() {
if (this.string == null) {
if (this.length == 0) {
this.string = EMPTY_STRING;
}
else {
this.string = new String(this.bytes, this.offset, this.length,
StandardCharsets.UTF_8);
}
}
return this.string;
}
public boolean matches(CharSequence name, char suffix) {
int charIndex = 0;
int nameLen = name.length();
@@ -178,30 +164,6 @@ final class AsciiBytes {
return 0;
}
@Override
public int hashCode() {
int hash = this.hash;
if (hash == 0 && this.bytes.length > 0) {
for (int i = this.offset; i < this.offset + this.length; i++) {
int b = this.bytes[i];
int remainingUtfBytes = getNumberOfUtfBytes(b) - 1;
b &= INITIAL_BYTE_BITMASK[remainingUtfBytes];
for (int j = 0; j < remainingUtfBytes; j++) {
b = (b << 6) + (this.bytes[++i] & SUBSEQUENT_BYTE_BITMASK);
}
if (b <= 0xFFFF) {
hash = 31 * hash + b;
}
else {
hash = 31 * hash + ((b >> 0xA) + 0xD7C0);
hash = 31 * hash + ((b & 0x3FF) + 0xDC00);
}
}
this.hash = hash;
}
return hash;
}
private int getNumberOfUtfBytes(int b) {
if ((b & 0x80) == 0) {
return 1;
@@ -236,6 +198,44 @@ final class AsciiBytes {
return false;
}
@Override
public int hashCode() {
int hash = this.hash;
if (hash == 0 && this.bytes.length > 0) {
for (int i = this.offset; i < this.offset + this.length; i++) {
int b = this.bytes[i];
int remainingUtfBytes = getNumberOfUtfBytes(b) - 1;
b &= INITIAL_BYTE_BITMASK[remainingUtfBytes];
for (int j = 0; j < remainingUtfBytes; j++) {
b = (b << 6) + (this.bytes[++i] & SUBSEQUENT_BYTE_BITMASK);
}
if (b <= 0xFFFF) {
hash = 31 * hash + b;
}
else {
hash = 31 * hash + ((b >> 0xA) + 0xD7C0);
hash = 31 * hash + ((b & 0x3FF) + 0xDC00);
}
}
this.hash = hash;
}
return hash;
}
@Override
public String toString() {
if (this.string == null) {
if (this.length == 0) {
this.string = EMPTY_STRING;
}
else {
this.string = new String(this.bytes, this.offset, this.length,
StandardCharsets.UTF_8);
}
}
return this.string;
}
static String toString(byte[] bytes) {
return new String(bytes, StandardCharsets.UTF_8);
}

View File

@@ -106,23 +106,6 @@ final class StringSequence implements CharSequence {
return subSequence(offset, offset + prefix.length()).equals(prefix);
}
@Override
public String toString() {
return this.source.substring(this.start, this.end);
}
@Override
public int hashCode() {
int hash = this.hash;
if (hash == 0 && length() > 0) {
for (int i = this.start; i < this.end; i++) {
hash = 31 * hash + this.source.charAt(i);
}
this.hash = hash;
}
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -146,4 +129,21 @@ final class StringSequence implements CharSequence {
return true;
}
@Override
public int hashCode() {
int hash = this.hash;
if (hash == 0 && length() > 0) {
for (int i = this.start; i < this.end; i++) {
hash = 31 * hash + this.source.charAt(i);
}
this.hash = hash;
}
return hash;
}
@Override
public String toString() {
return this.source.substring(this.start, this.end);
}
}