Skip to content

Commit

Permalink
Revert "avoiding more NoSuchMethod exceptions (google#6671)"
Browse files Browse the repository at this point in the history
This reverts commit 752c7b5.
  • Loading branch information
bjornharrtell committed Aug 14, 2021
1 parent a619099 commit 99de837
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion java/com/google/flatbuffers/ByteBufferReadWriteBuf.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public ByteBufferReadWriteBuf(ByteBuffer bb) {

@Override
public void clear() {
((Buffer) buffer).clear();
buffer.clear();
}

@Override
Expand Down
8 changes: 4 additions & 4 deletions java/com/google/flatbuffers/FlatBufferBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public FlatBufferBuilder(int initial_size, ByteBufferFactory bb_factory,
this.bb_factory = bb_factory;
if (existing_bb != null) {
bb = existing_bb;
((Buffer) bb).clear();
bb.clear();
bb.order(ByteOrder.LITTLE_ENDIAN);
} else {
bb = bb_factory.newByteBuffer(initial_size);
Expand Down Expand Up @@ -154,7 +154,7 @@ public FlatBufferBuilder(ByteBuffer existing_bb) {
public FlatBufferBuilder init(ByteBuffer existing_bb, ByteBufferFactory bb_factory){
this.bb_factory = bb_factory;
bb = existing_bb;
((Buffer) bb).clear();
bb.clear();
bb.order(ByteOrder.LITTLE_ENDIAN);
minalign = 1;
space = bb.capacity();
Expand Down Expand Up @@ -235,7 +235,7 @@ public static boolean isFieldPresent(Table table, int offset) {
*/
public void clear(){
space = bb.capacity();
((Buffer) bb).clear();
bb.clear();
minalign = 1;
while(vtable_in_use > 0) vtable[--vtable_in_use] = 0;
vtable_in_use = 0;
Expand Down Expand Up @@ -275,7 +275,7 @@ static ByteBuffer growByteBuffer(ByteBuffer bb, ByteBufferFactory bb_factory) {

((Buffer) bb).position(0);
ByteBuffer nbb = bb_factory.newByteBuffer(new_buf_size);
new_buf_size = ((Buffer) nbb).clear().capacity(); // Ensure the returned buffer is treated as empty
new_buf_size = nbb.clear().capacity(); // Ensure the returned buffer is treated as empty
((Buffer) nbb).position(new_buf_size - old_buf_size);
nbb.put(bb);
return nbb;
Expand Down
4 changes: 2 additions & 2 deletions java/com/google/flatbuffers/Utf8Old.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public int encodedLength(CharSequence in) {
if (cache.lastOutput == null || cache.lastOutput.capacity() < estimated) {
cache.lastOutput = ByteBuffer.allocate(Math.max(128, estimated));
}
((Buffer) cache.lastOutput).clear();
cache.lastOutput.clear();
cache.lastInput = in;
CharBuffer wrap = (in instanceof CharBuffer) ?
(CharBuffer) in : CharBuffer.wrap(in);
Expand All @@ -68,7 +68,7 @@ public int encodedLength(CharSequence in) {
throw new IllegalArgumentException("bad character encoding", e);
}
}
((Buffer) cache.lastOutput).flip();
cache.lastOutput.flip();
return cache.lastOutput.remaining();
}

Expand Down

0 comments on commit 99de837

Please sign in to comment.