RFR: 8294972: Convert jdk.jlink internal plugins to use the Classfile API [v12]

ExE Boss duke at openjdk.org
Wed Mar 22 04:00:03 UTC 2023


On Fri, 17 Mar 2023 17:30:41 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> Adam Sotona has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 220 commits:
>> 
>>  - Merge branch 'master' into JDK-8294972-jlink-plugins
>>  - SystemModulesPlugin::genClassBytes rename
>>  - SystemModulesPlugin::getClassBytes rename
>>  - Revert "implementation of custom ResourceHelper in IncludeLocalesPlugin"
>>  - remaining cleanup in SystemModulesPlugin
>>  - implementation of custom ResourceHelper in IncludeLocalesPlugin
>>  - fixed SystemModulesPlugin
>>  - fixed StripJavaDebugAttribute to drop line numbers from code
>>  - long lines wrapped
>>  - StripJavaDebugAttributesPlugin transformation fixed
>>  - ... and 210 more: https://git.openjdk.org/jdk/compare/4486f1b7...4e5b9651
>
> 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));

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

PR Review Comment: https://git.openjdk.org/jdk/pull/12944#discussion_r1141017881


More information about the core-libs-dev mailing list