On Mon, 20 Mar 2023 14:02:13 GMT, Adam Sotona <asot...@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+li...@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

Reply via email to