On Wed, 26 Nov 2025 16:46:41 GMT, David Beaumont <[email protected]> wrote:

>> 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.
>
> David Beaumont has updated the pull request incrementally with two additional 
> commits since the last revision:
> 
>  - Redo bad indentation
>  - undo blank line

Roger's idea to use the release version seems a good idea but might be tricky 
to setup. That is, it might require some build foo as the source can't 
reference Runtime.Version or other APIs because it gets compiled `--release` 
for jrt-fs.jar. That said, not to say if it's worth it as the jimage tool is 
not documented so should be rare to have these mismatch issues.

On the current proposal: I don't particularly like having 
BasicImageReader.readHeader throw an IOException with a path to the jimage tool 
as this IOException may pop up in other contexts. I wonder if it could throw a 
more specific mismatch exception for this case so that the jimage tool can 
handle, and translate into something that includes a path to itself.

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

PR Comment: https://git.openjdk.org/jdk/pull/28456#issuecomment-3739133289

Reply via email to