RFR: 8304502: Classfile API class hierarchy makes assumptions when class is not resolved [v2]

Adam Sotona asotona at openjdk.org
Tue Mar 21 10:44:20 UTC 2023


On Tue, 21 Mar 2023 09:45:56 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update src/java.base/share/classes/jdk/internal/classfile/impl/ClassHierarchyImpl.java
>>   
>>   Co-authored-by: liach <7806504+liach at users.noreply.github.com>
>
> src/java.base/share/classes/jdk/internal/classfile/impl/ClassHierarchyImpl.java line 172:
> 
>> 170:         public StaticClassHierarchyResolver(Collection<ClassDesc> interfaceNames, Map<ClassDesc, ClassDesc> classToSuperClass) {
>> 171:             map = HashMap.newHashMap(interfaceNames.size() + classToSuperClass.size() + 1);
>> 172:             map.put(ConstantDescs.CD_Object, new ClassHierarchyInfo(ConstantDescs.CD_Object, false, null));
> 
> Hello Adam, for this `Object` class representation, perhaps you could just have a `static final` field which is instantiated to this value and reused instead of creating a new instance each time?

fixed, thanks.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13099#discussion_r1143179081


More information about the core-libs-dev mailing list