[javac] Option --release and compiled version of Requires

Christian Stein sormuras at gmail.com
Mon Oct 28 17:38:51 UTC 2019


Hi,

why and how does the `--release n` option of `javac` control the compiled
version of ModuleDescriptor.Requires directive?

Take this simple module-info.java from a sample project at [*0]:

  module foo {}

My current observation is that if you omit the --release option [*1] or if
you pass n = N [*2], the current version N (its full version) is recorded
in the resulting module descriptor. [*3,*4]

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

If you pass a value of n, with n < N and N being the feature release number
of the current javac tool, the compiled version of the mandated "java.base"
module is dropped/lost in ... compilation. See [*5, *6] for `release 9[10]`
usages that produce the following ModuleDescriptor String-representation:

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

Is this behaviour expected?

Cheers,
Christian

[*0] https://github.com/sormuras/sandbox/tree/master/java-compiled-versions
[*1]
https://github.com/sormuras/sandbox/commit/60bf55a4a42e234894a9d7e6d502a685c750da9e/checks?check_suite_id=284695530#step:5:9
[*2]
https://github.com/sormuras/sandbox/commit/60bf55a4a42e234894a9d7e6d502a685c750da9e/checks?check_suite_id=284695530#step:6:9
[*3]
https://github.com/sormuras/sandbox/commit/60bf55a4a42e234894a9d7e6d502a685c750da9e/checks?check_suite_id=284695530#step:5:13
[*4]
https://github.com/sormuras/sandbox/commit/60bf55a4a42e234894a9d7e6d502a685c750da9e/checks?check_suite_id=284695530#step:6:13
[*5] https://github.com/sormuras/sandbox/runs/277876326#step:7:9
[*6] https://github.com/sormuras/sandbox/runs/277876326#step:8:9


More information about the jdk-dev mailing list