RFR: 8350938: ResourceParsingClassHierarchyResolver inflates all Utf8 CP entries [v2]

Trevor Bond duke at openjdk.org
Tue Nov 25 23:08:49 UTC 2025


On Tue, 25 Nov 2025 04:25:05 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Trevor Bond has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Remove unnecessary imports
>
> src/java.base/share/classes/jdk/internal/classfile/impl/ClassHierarchyImpl.java line 171:
> 
>> 169:             if (ci == null) return null;
>> 170:             try (ci) {
>> 171:                 ClassReader reader = new ClassReaderImpl(ci.readAllBytes(), (ClassFileImpl) ClassFile.of());
> 
> Suggestion:
> 
>                 var reader = new ClassReaderImpl(ci.readAllBytes(), ClassFileImpl.DEFAULT_CONTEXT);
> 
> And you can remove the 3 imports you have added.

Thank you for this. I adjusted that line and the imports accordingly. I still found a need to import `java.lang.classfile.constantpool.ClassEntry` for the line further down converting the ClassEntry to a ClassDesc. If that can also be avoided I'm happy to fix. I also removed a few imports previously needed but that can be removed with these changes.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28458#discussion_r2561849713


More information about the core-libs-dev mailing list