What version of protobuf and what language are you using?
Version: protobuf-java-3.21.7 (there were no problems with 3.21.1)
Language: Java
What operating system (Linux, Windows, ...) and version?
Linux
What runtime / compiler are you using (e.g., python version or gcc version)
Build JDK 9+ and run with JRE 8
What did you do?
Build Protobuf with JDK 9+ and run with JRE 8.
Because CodedOutputStream uses ByteBuffer.position(int) that overrides the method in the superclass Buffer from JDK9+,
it produces NoSuchMethodError when it's run with JRE 8.
as follow:
java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
at com.google.protobuf.CodedOutputStream$UnsafeDirectNioEncoder.writeStringNoTag(CodedOutputStream.java:2153)
at com.google.protobuf.CodedOutputStream$UnsafeDirectNioEncoder.writeString(CodedOutputStream.java:1922)
at com.google.protobuf.GeneratedMessageV3.writeString(GeneratedMessageV3.java:3195)
at com.linecorp.armeria.grpc.testing.Messages$SimpleResponse.writeTo(Messages.java:4363)
at com.linecorp.armeria.internal.common.grpc.GrpcMessageMarshaller.serializeProto(GrpcMessageMarshaller.java:202)
at com.linecorp.armeria.internal.common.grpc.GrpcMessageMarshaller.serializeResponse(GrpcMessageMarshaller.java:145)
at com.linecorp.armeria.internal.common.grpc.GrpcMessageMarshallerTest.serializeResponse(GrpcMessageMarshallerTest.java:121)
This is a well-described article:
https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror/
Please note that there weren't any problems with 3.21.2 version.
What did you expect to see
Just work fine.
What did you see instead?
NoSuchMethodError
What version of protobuf and what language are you using?
Version: protobuf-java-3.21.7 (there were no problems with 3.21.1)
Language: Java
What operating system (Linux, Windows, ...) and version?
Linux
What runtime / compiler are you using (e.g., python version or gcc version)
Build JDK 9+ and run with JRE 8
What did you do?
Build Protobuf with JDK 9+ and run with JRE 8.
Because
CodedOutputStreamusesByteBuffer.position(int)that overrides the method in the superclassBufferfrom JDK9+,it produces
NoSuchMethodErrorwhen it's run with JRE 8.as follow:
This is a well-described article:
https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror/
Please note that there weren't any problems with 3.21.2 version.
What did you expect to see
Just work fine.
What did you see instead?
NoSuchMethodError