RFR: 8304502: Classfile API class hierarchy makes assumptions when class is not resolved [v2]
Chen Liang
liach at openjdk.org
Mon Mar 20 14:06:45 UTC 2023
On Mon, 20 Mar 2023 14:02:13 GMT, Adam Sotona <asotona at openjdk.org> wrote:
>> Classfile API class hierarchy makes assumptions when class is not resolved and that may lead to silent generation of invalid stack maps. Only debug-level log information of case is actually provided.
>>
>> Proposed patch throws IllegalArgumentException when the class is not resolved instead.
>>
>> Thanks for review.
>>
>> Adam
>
> 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 171:
> 169:
> 170: public StaticClassHierarchyResolver(Collection<ClassDesc> interfaceNames, Map<ClassDesc, ClassDesc> classToSuperClass) {
> 171: map = new HashMap<>(interfaceNames.size() + classToSuperClass.size() + 1);
Should use HashMap.newHashMap instead
Suggestion:
map = HashMap.newHashMap(interfaceNames.size() + classToSuperClass.size() + 1);
-------------
PR: https://git.openjdk.org/jdk/pull/13099
More information about the core-libs-dev
mailing list