Skip to content

feat: Declare the client as a module, and name the other modules after their root packages. - #16

Merged
goloroden merged 2 commits into
mainfrom
add-automatic-module-names
Oct 8, 2026
Merged

goloroden merged 2 commits into
mainfrom
add-automatic-module-names

Conversation

@goloroden

Copy link
Copy Markdown
Member

Gives all three modules stable names for the Java module system, named after their root packages. Before, Java derived the names from the file names of the jars (eventsourcingdb, eventsourcingdb.testcontainers, eventsourcingdb.spring.boot.starter). Those names change when a file is renamed, and they would have been fixed by the first publication.

What changes

  • Client (io.thenativeweb.eventsourcingdb): It now declares itself in a module-info.java.
    • It exports its package.
    • It requires java.net.http, org.jspecify and tools.jackson.databind transitively, since its API uses their types.
    • An application on the module path only writes requires io.thenativeweb.eventsourcingdb;.
    • With a mere Automatic-Module-Name, it would need three: an automatic module does not pass on its dependencies. Without requires tools.jackson.databind; the application failed with ClassNotFoundException: tools.jackson.databind.JsonNode, and without requires java.net.http; with NoClassDefFoundError: java/net/http/HttpClient.
  • Test container (io.thenativeweb.eventsourcingdb.testcontainers) and starter (io.thenativeweb.eventsourcingdb.springboot): These set Automatic-Module-Name in their manifests. They can not declare themselves in a module-info, since Testcontainers and Spring Boot do not either, and javac warns about requiring such modules (-Xlint:all with -Werror).
  • README: It names the module to require.

Verification

  • make qa passes from a clean build (191 + 13 + 10 tests, 100% coverage). Gradle keeps running the tests on the classpath, so the tests do not cover the module boundaries; the compiler does.
  • jar --describe-module shows the three names. For the two automatic modules, it shows the same name after renaming the jar.
  • A small application on the module path ran with requires io.thenativeweb.eventsourcingdb; only. Against a real EventSourcingDB, it wrote an event, read it back and verified its hash.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Hc2MPSLu7HDHTm8HiBsrDz

goloroden and others added 2 commits October 8, 2026 22:30
…ule path only need to require it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hc2MPSLu7HDHTm8HiBsrDz
@goloroden
goloroden requested a review from a team as a code owner October 8, 2026 20:46
@goloroden goloroden self-assigned this Oct 8, 2026
@goloroden
goloroden merged commit 682fc53 into main Oct 8, 2026
2 checks passed
@goloroden
goloroden deleted the add-automatic-module-names branch October 8, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant