protocolbuffers / protocolbuffers/protobuf

Add a `module-info.java`

Open
#16,133 35 comments 9 reactions 3 assignees View on GitHub

@esrauchg is already working on this.

Since Jun 3, 2025.

enhancement java keep open packaging & distribution
Dominant language
C++
Stars
72k
Forks
16.3k
Avg merge
1d 17h
Merged PRs (30d)
140

Description

What language does this apply to?
If it's a proto syntax change, is it for proto2 or proto3? N/A
If it's about generated code change, what programming language? Java

Describe the problem you are trying to solve.
I want to use Protobuf Java with jlink. Unfortunately, jlink rejects JARs with an Automatic-Module-Name set; it is required to define a module-info.java.

Describe the solution you'd like
I would like Protobuf Java to ship a module-info.java, in an MRJAR, to preserve existing JDK support. I am not proposing a change to the JVM bytecode minimum support level.

Describe alternatives you've considered
I have considered solutions like Moditect, but they complicate my build greatly because dependencies must be transformed before being consumed by the Java Compiler.

Additional context
Guava is considering a PR for this. Recently, Error Prone and other core libs have released new versions with a module-info.java definition. Thus, Protobuf's transitive dependencies may be ready for a fully modular Java build.

UPDATE: Guava has shipped JPMS.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.