RFR: 8361102: java.lang.classfile.CodeBuilder.branch(Opcode op, Label target) doesn't throw IllegalArgumentException - if op is not of Opcode.Kind.BRANCH

Chen Liang liach at openjdk.org
Wed Jul 9 21:20:11 UTC 2025


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.

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

Commit messages:
 - Test refresh
 - 8361102: java.lang.classfile.CodeBuilder.branch(Opcode op, Label target) doesn't throw IllegalArgumentException - if op is not of Opcode.Kind.BRANCH

Changes: https://git.openjdk.org/jdk/pull/26229/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26229&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8361102
  Stats: 171 lines in 5 files changed: 120 ins; 27 del; 24 mod
  Patch: https://git.openjdk.org/jdk/pull/26229.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26229/head:pull/26229

PR: https://git.openjdk.org/jdk/pull/26229


More information about the core-libs-dev mailing list