protobuf Java 11 support

Created on 7 Jan 2019  路  10Comments  路  Source: protocolbuffers/protobuf

Hi experts,

Are you planning to release a protobuf version which is compatible with Java 11? If yes, when do you expect this will happen?
The jdeps report is complaining for:
protobuf-java.jar -> jdk.unsupported com.google.protobuf.UnsafeUtil -> sun.misc.Unsafe JDK internal API (jdk.unsupported) com.google.protobuf.UnsafeUtil$1 -> sun.misc.Unsafe JDK internal API (jdk.unsupported) com.google.protobuf.UnsafeUtil$JvmMemoryAccessor -> sun.misc.Unsafe JDK internal API (jdk.unsupported) com.google.protobuf.UnsafeUtil$MemoryAccessor -> sun.misc.Unsafe JDK internal API (jdk.unsupported) JDK Internal API Suggested Replacement ---------------- --------------------- sun.misc.Unsafe See http://openjdk.java.net/jeps/260

Thanks in advance for the reply.

Regards,
Mario

P3 enhancement java

Most helpful comment

@rodislav You have to add the following dependency:

xml <dependency> <groupId>javax.annotation</groupId> <artifactId>javax.annotation-api</artifactId> <version>1.3.2</version> </dependency>

All 10 comments

I think in the near future we don't have any plan for that.

Thanks for the prompt reply!
The problem is that Oracle will stop supporting Java 8 JDK officially by the end of January 2019.
There was one issue that is related to this error and which is solved - https://github.com/protocolbuffers/protobuf/issues/3781 but it does not solves all usages of sun.misc.Unsafe. There are plenty of them in https://github.com/protocolbuffers/protobuf/blob/master/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java.
Please enter some estimation when you have more information when you think a new version supporting Java 11 can be released. Thanks in advance!

Currently UnsafeUtil.java is mainly used in UnsafeDecoder for CodedInputStream, which is needed for decoding directly allocated ByteBuffer. Some other dependents are using this feature, e.g. grpc.
What's more, we are proposing to open source an internally used java-experimental android version protobuf which is highly utilizing UnsafeUtil.

So I think this will exist for some time. Sorry for the inconvenience.
But we are actively working on finding out a solution for this.

Any ETA on this?

For me all those issues have been fixed in 3.7.1 or later (at least I don't see any warnings anymore).

Same here, I'm able to build with JDK 11 in 3.8

Hi, when I try to compile it, I see this piece of code in generated classes that is failing in java 11

@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.22.1)",
    comments = "Source: PositionHoldingService.proto")

javax.annotation.Generated --> cannot find symbol

@rodislav You have to add the following dependency:

xml <dependency> <groupId>javax.annotation</groupId> <artifactId>javax.annotation-api</artifactId> <version>1.3.2</version> </dependency>

I thought this was fixed at https://github.com/protocolbuffers/protobuf/commit/624a40a387e1b2da4c6bbde44ad3d0a5efb9879b#diff-6c9e043b78f78efc096211703bb7fa4a ?

Was this page helpful?
0 / 5 - 0 ratings