google / google/flatbuffers

Add module-info.java to flatbuffers-java for JPMS support

Open
#9,111 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
26.5k
Forks
3.7k
PR merge metrics
No merged PRs in 30d

Description

## Problem

`flatbuffers-java` ships without a `module-info.java`, so it becomes a **filename-based
automatic module** on the Java module path. This has two consequences:

1. The module name (`flatbuffers.java`) is derived from the JAR filename and can change if the
artifact is renamed or shaded — making it unreliable to `requires` in downstream
`module-info.java` files.
2. Maven Surefire (and other tools) warn that projects depending on filename-based automodules
**must not be published to Maven Central** as proper modular JARs:

```
[WARNING] Required filename-based automodules detected: [flatbuffers-java-25.2.10.jar].
Please don't publish this project to a public artifact repository!
```

## Expected

`flatbuffers-java` ships with a `module-info.java` that:
- declares a stable module name (e.g. `com.google.flatbuffers`)
- exports `com.google.flatbuffers`

## Suggested change

Add `java/src/main/java/module-info.java`:

```java
module com.google.flatbuffers {
exports com.google.flatbuffers;
}
```

This is a non-breaking addition. Classpath users are unaffected; module-path users get a
stable, named module.

## Environment

- flatbuffers-java 25.2.10
- Java 25 / JPMS

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.