On Sun, 18 Jan 2026 05:17:40 GMT, Alexander Matveev <[email protected]>
wrote:
>> - Version will be read from JDK's release file if not provided via
>> `--version` for runtime installer.
>> - Added test to cover added functionality.
>> - On macOS and Windows version from JDK's release file will be normalized if
>> it does not fit platform requirements.
>
> Alexander Matveev has updated the pull request incrementally with one
> additional commit since the last revision:
>
> 8357404: jpackage should attempt to get a package version from the JDK's
> release file if the --version option is not specified [v6]
src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/RuntimeVersionReader.java
line 38:
> 36:
> 37: public static Optional<String> readVersion(Path releaseFilePath)
> throws IOException {
> 38: if (!Files.isRegularFile(releaseFilePath)) {
What is the point of this check? If you remove it and let the function throw an
IOException, the function signature can be simplified to `String
readVersion(Path releaseFilePath) throws IOException`. Making it clear that the
function either returns a valid JDK version or throws.
If you don't want to deal with handling exceptions in the caller, you can
implement it without throwing:
Optional<String> readVersion(Path releaseFilePath) {
try {
...
return Optional.of(version);
} catch (IOException ex) {
return Optional.empty();
}
}
Currently, it is a confusing mix of both approaches.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29260#discussion_r2755960178