RFR: 8294972: Convert jdk.jlink internal plugins to use the Classfile API [v12]
Adam Sotona
asotona at openjdk.org
Wed Mar 22 07:04:58 UTC 2023
On Sat, 18 Mar 2023 13:15:01 GMT, ExE Boss <duke at openjdk.org> wrote:
>> src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java line 309:
>>
>>> 307: TAG_INVOKEDYNAMIC -> offset += 5;
>>> 308: case TAG_LONG,
>>> 309: TAG_DOUBLE -> {offset += 9; cpSlot++;} //additional slot for double and long entries
>>
>> should this add the default case and throw to prepare for future change?
>
> That’s definitely better than breaking silently.
> Suggestion:
>
> TAG_DOUBLE -> {offset += 9; cpSlot++;} //additional slot for double and long entries
> default -> throw new IllegalArgumentException("Unknown constant pool entry: 0x" + Integer.toHexString(Byte.toUnsignedInt(bytes[offset])).toUpperCase(Locale.ROOT));
@ExE-Boss I've applied your proposed exception message construction, thanks.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/12944#discussion_r1144312955
More information about the core-libs-dev
mailing list