From 752c7b576d395ffab646aa6878ccf4e17a0a7a2e Mon Sep 17 00:00:00 2001 From: Kamil Rojewski Date: Thu, 3 Jun 2021 23:18:45 +0200 Subject: [PATCH] avoiding more NoSuchMethod exceptions (#6671) refs #6657 --- grpc/flatbuffers-java-grpc/pom.xml | 2 +- grpc/pom.xml | 2 +- grpc/tests/pom.xml | 4 ++-- java/com/google/flatbuffers/ByteBufferReadWriteBuf.java | 2 +- java/com/google/flatbuffers/FlatBufferBuilder.java | 8 ++++---- java/com/google/flatbuffers/Utf8Old.java | 4 ++-- pom.xml | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/grpc/flatbuffers-java-grpc/pom.xml b/grpc/flatbuffers-java-grpc/pom.xml index 59d8e9c7ee6..7cd6e563c55 100644 --- a/grpc/flatbuffers-java-grpc/pom.xml +++ b/grpc/flatbuffers-java-grpc/pom.xml @@ -6,7 +6,7 @@ com.google.flatbuffers flatbuffers-parent - 2.0.1 + 2.0.2 flatbuffers-java-grpc ${project.artifactId} diff --git a/grpc/pom.xml b/grpc/pom.xml index e6291d12bdf..a7584c11eb3 100644 --- a/grpc/pom.xml +++ b/grpc/pom.xml @@ -4,7 +4,7 @@ com.google.flatbuffers flatbuffers-parent pom - 2.0.1 + 2.0.2 flatbuffers-parent parent pom for flatbuffers java artifacts diff --git a/grpc/tests/pom.xml b/grpc/tests/pom.xml index e889a0c1244..835a765ff28 100644 --- a/grpc/tests/pom.xml +++ b/grpc/tests/pom.xml @@ -4,13 +4,13 @@ com.google.flatbuffers flatbuffers-parent - 2.0.1 + 2.0.2 grpc-test Example/Test project demonstrating usage of flatbuffers with GRPC-Java instead of protobufs - 2.0.1 + 2.0.2 diff --git a/java/com/google/flatbuffers/ByteBufferReadWriteBuf.java b/java/com/google/flatbuffers/ByteBufferReadWriteBuf.java index cb109f76c4d..55acdd05a55 100644 --- a/java/com/google/flatbuffers/ByteBufferReadWriteBuf.java +++ b/java/com/google/flatbuffers/ByteBufferReadWriteBuf.java @@ -15,7 +15,7 @@ public ByteBufferReadWriteBuf(ByteBuffer bb) { @Override public void clear() { - buffer.clear(); + ((Buffer) buffer).clear(); } @Override diff --git a/java/com/google/flatbuffers/FlatBufferBuilder.java b/java/com/google/flatbuffers/FlatBufferBuilder.java index 6653f39fdca..1e181488915 100644 --- a/java/com/google/flatbuffers/FlatBufferBuilder.java +++ b/java/com/google/flatbuffers/FlatBufferBuilder.java @@ -92,7 +92,7 @@ public FlatBufferBuilder(int initial_size, ByteBufferFactory bb_factory, this.bb_factory = bb_factory; if (existing_bb != null) { bb = existing_bb; - bb.clear(); + ((Buffer) bb).clear(); bb.order(ByteOrder.LITTLE_ENDIAN); } else { bb = bb_factory.newByteBuffer(initial_size); @@ -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; - bb.clear(); + ((Buffer) bb).clear(); bb.order(ByteOrder.LITTLE_ENDIAN); minalign = 1; space = bb.capacity(); @@ -235,7 +235,7 @@ public static boolean isFieldPresent(Table table, int offset) { */ public void clear(){ space = bb.capacity(); - bb.clear(); + ((Buffer) bb).clear(); minalign = 1; while(vtable_in_use > 0) vtable[--vtable_in_use] = 0; vtable_in_use = 0; @@ -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 = nbb.clear().capacity(); // Ensure the returned buffer is treated as empty + new_buf_size = ((Buffer) 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; diff --git a/java/com/google/flatbuffers/Utf8Old.java b/java/com/google/flatbuffers/Utf8Old.java index ba15031e4b3..64b0cf02e00 100644 --- a/java/com/google/flatbuffers/Utf8Old.java +++ b/java/com/google/flatbuffers/Utf8Old.java @@ -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)); } - cache.lastOutput.clear(); + ((Buffer) cache.lastOutput).clear(); cache.lastInput = in; CharBuffer wrap = (in instanceof CharBuffer) ? (CharBuffer) in : CharBuffer.wrap(in); @@ -68,7 +68,7 @@ public int encodedLength(CharSequence in) { throw new IllegalArgumentException("bad character encoding", e); } } - cache.lastOutput.flip(); + ((Buffer) cache.lastOutput).flip(); return cache.lastOutput.remaining(); } diff --git a/pom.xml b/pom.xml index 52782ef6c21..fe1cec7e51e 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.flatbuffers flatbuffers-java - 2.0.1 + 2.0.2 bundle FlatBuffers Java API