javac/jdeps and requires with version

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

javac/jdeps and requires with version

Christian Stein

given an empty module declaration:

  module foo{}

Compile it with javac using various valid "--release r" variants
yields different module descriptors in addition to the generated
class file version.

For JDK N, javac seems to include the version of a required
module only if you omit the release option or if you pass r = N.
For example, when having JDK 13.0.1 installed, the String
representation of module foo is:

  module { name: foo, [mandated java.base (@13.0.1)] }

For every r value with 9 <= r < N  it only reads:

   module { name: foo, [mandated java.base] }

What is the reason for this behaviour regarding
compiled version of requires directives?

Find the log of a MVE [1] at [2].

Additionally, I checked the following tools:

- "jdeps" also emits the version of "java.base"
- "jar --describe-module" does not emit the version of "java.base"
- "javap" does not emit the version of "java.base"

A side(?) effect of this can also be seen at [3], which
shows the result of running jdeps --check org.junit.platform.engine.
The only difference of the actual and the suggested
module descriptor are the versions attached to the
requires elements.