Skip to content

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

@dfa1

Description

@dfa1

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions