RFR: 8372301: Improve error message for jimage command line tool regarding version mismatch

David Beaumont duke at openjdk.org
Fri Nov 21 16:38:44 UTC 2025


Adds a semantic reason for failure which can be optionally interrogated by calling code.
Use the 'Reason.BAD_VERSION' value to trigger a different translated error message from the JImageTask.

I would consider moving the error message string into the Reason enum to simplify the code triggering the error and avoid message string duplication, but it's not straightforward due to the need to supply the version numbers.

We can use this approach to provide translated messages for all the distinct failure reasons if needed.

-------------

Commit messages:
 - remove path inference
 - change error message for version mismatch

Changes: https://git.openjdk.org/jdk/pull/28456/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28456&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8372301
  Stats: 56 lines in 3 files changed: 38 ins; 2 del; 16 mod
  Patch: https://git.openjdk.org/jdk/pull/28456.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28456/head:pull/28456

PR: https://git.openjdk.org/jdk/pull/28456


More information about the core-libs-dev mailing list