Skip to content

Commit cfecfe4

Browse files
committed
Revisit equals, hashCode and toString
1 parent 6c7e6e0 commit cfecfe4

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/checksum/ByteBufVisitor.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,58 +1000,58 @@ public String toString(int index, int length, Charset charset) {
10001000
}
10011001

10021002
@Override
1003-
public int hashCode() {
1003+
public int compareTo(ByteBuf buffer) {
10041004
throw new UnsupportedOperationException();
10051005
}
10061006

10071007
@Override
1008-
public boolean equals(Object obj) {
1008+
public ByteBuf retain(int increment) {
10091009
throw new UnsupportedOperationException();
10101010
}
10111011

10121012
@Override
1013-
public int compareTo(ByteBuf buffer) {
1013+
public int refCnt() {
10141014
throw new UnsupportedOperationException();
10151015
}
10161016

10171017
@Override
1018-
public String toString() {
1018+
public ByteBuf retain() {
10191019
throw new UnsupportedOperationException();
10201020
}
10211021

10221022
@Override
1023-
public ByteBuf retain(int increment) {
1023+
public ByteBuf touch() {
10241024
throw new UnsupportedOperationException();
10251025
}
10261026

10271027
@Override
1028-
public int refCnt() {
1028+
public ByteBuf touch(Object hint) {
10291029
throw new UnsupportedOperationException();
10301030
}
10311031

10321032
@Override
1033-
public ByteBuf retain() {
1033+
public boolean release() {
10341034
throw new UnsupportedOperationException();
10351035
}
10361036

10371037
@Override
1038-
public ByteBuf touch() {
1038+
public boolean release(int decrement) {
10391039
throw new UnsupportedOperationException();
10401040
}
10411041

10421042
@Override
1043-
public ByteBuf touch(Object hint) {
1044-
throw new UnsupportedOperationException();
1043+
public String toString() {
1044+
return Object.class.getSimpleName() + '@' + Integer.toHexString(System.identityHashCode(this));
10451045
}
10461046

10471047
@Override
1048-
public boolean release() {
1049-
throw new UnsupportedOperationException();
1048+
public int hashCode() {
1049+
return System.identityHashCode(this);
10501050
}
10511051

10521052
@Override
1053-
public boolean release(int decrement) {
1054-
throw new UnsupportedOperationException();
1053+
public boolean equals(Object obj) {
1054+
return obj == this;
10551055
}
10561056
}
10571057
}

0 commit comments

Comments
 (0)