On Fri, 11 Jul 2025 14:03:44 GMT, Adam Sotona <[email protected]> wrote:
>> Currently, DirectCodeBuilder is erroneously missing argument checks for a
>> few of its override methods that take arguments such as Opcode and the array
>> size for multianewarray and the switches, which would write something before
>> throwing an exception. We correct these problems and verify with some tests.
>>
>> Note: Other Label-writing methods resolve their label eagerly so they are
>> not (yet) problematic.
>
> src/java.base/share/classes/jdk/internal/classfile/impl/DirectCodeBuilder.java
> line 628:
>
>> 626: @Override
>> 627: public int compare(SwitchCase c1, SwitchCase c2) {
>> 628: return Integer.compare(c1.caseValue(), c2.caseValue());
>
> isn this an implicit null check?
Yes, but this doesn't run when the list has just one element of `null` - see
case
https://github.com/openjdk/jdk/pull/26229/files#diff-cb987200ae23ff7522bd692d4707a012b115bf778a1265ba11db0b3bf5c9aa7cR98
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26229#discussion_r2200872686