RFR: 8357404: jpackage should attempt to get a package version from the JDK's release file if the --version option is not specified [v6]
Alexey Semenyuk
asemenyuk at openjdk.org
Wed Feb 4 03:28:03 UTC 2026
On Tue, 3 Feb 2026 23:15:24 GMT, Alexander Matveev <almatvee at openjdk.org> wrote:
>> test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/util/RuntimeVersionReaderTest.java line 41:
>>
>>> 39: import org.junit.jupiter.api.io.TempDir;
>>> 40:
>>> 41: public class RuntimeVersionReaderTest {
>>
>> I doubt this unit test has ever been executed.
>
> Confused. I did run it manually. Test works as expected.
>
> jtreg -w build/jtreg/work -r build/jtreg/report -jdk build/macosx-x64/images/jdk open/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/util/RuntimeVersionReaderTest.java
> Test results: passed: 1
> Framework-based tests: 3 = 0 TestNG + 3 JUnit
I take it back. I didn't notice that `test_release_file_with_version()` sets the "JAVA_VERSION" property, and that `test_release_file_without_version()` sets the "**JDK**_VERSION" property. It is not the same property.
>> test/jdk/tools/jpackage/share/RuntimePackageTest.java line 160:
>>
>>> 158: .cannedFormattedString("message.release-version",
>>> 159: version, runtimeImage.toString()));
>>> 160: if (!normalizedVersion.isEmpty()) {
>>
>> Why would we not have a normalized version in some cases? Shouldn't it always be available?
>
> Message `Using version "{0}" normalized to platform supported format from "{1}"` is only displayed if version read from release file was normalized. If version can be used as is from release file, then message is not printed.
So, if the normalized version equals the source version, jpackage doesn't emit the normalization message. Make sense.
Then I suggest to split this test function in two:
@Parameter(value = {"27.1.2.3"}, ifOS = {LINUX, WINDOWS})
public static void testReleaseFileVersion(String version) {
testReleaseFileVersion(version, version);
}
@Parameter(value = {"27.1.2.3.4", "27.1.2"}, ifOS = MACOS)
public static void testReleaseFileVersion(String version, String normalizedVersion) {
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29260#discussion_r2761985750
PR Review Comment: https://git.openjdk.org/jdk/pull/29260#discussion_r2761967427
More information about the core-libs-dev
mailing list