Skip to content

Improve support for JDKs like Temurin that implement JEP 493 (Linking Run-Time Images without JMODs) #161

@xzel23

Description

@xzel23

I have applied PR #160 so that we have initial support for JEP 493 enabled JDKs like Temurin 24. This works if the user supplies the list of modules; the SuggestedModulesBuilder class however still relies on the jmods being present so the list of modules cannot be determined automatically.

A quick outline to fully support JEP 493 (untested, suggested by AI Assistant, but seems doable):

What to do:

  • Mount the runtime image via FileSystems.newFileSystem(URI.create("jrt:/"), Map.of()) or getFileSystem if already mounted.
  • Iterate /modules//module-info.class.
  • For each module-info.class, read bytes and call ModuleDescriptor.read(InputStream).
  • Collect md.exports().stream().map(Exports::source) per module.

Why this works:

  • It uses only public APIs and works for both: JDKs with jmods and JDKs without them (using the modules image).
  • No dependency on internal jimage APIs or on the existence of $JAVA_HOME/jmods.
  • Works on any modular JDK.

Metadata

Metadata

Assignees

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