RFR: 8294982: Implementation of Classfile API [v12]

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Feb 7 12:17:53 UTC 2023


On Mon, 6 Feb 2023 14:35:43 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/classfile/Opcode.java line 39:
>> 
>>> 37:  */
>>> 38: public enum Opcode {
>>> 39:     NOP(Classfile.NOP, 1, Kind.NOP),
>> 
>> This also duplicates the constants in classfile...
>
> On the contrary, it has been deduplicated. Opcode is referencing numeric constants stored in Classfile.

sure, but my question is - once you have a nice enum that is 1-1 with the opcodes - why would a client want to use the low-level opcode bytes? Shouldn't the API only deal with Opcodes? (and, in the rare occurrence where a client wants to really know the int value of an opcode, they can do e.g. `PUTSTATIC.bytecode()`)

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

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



More information about the build-dev mailing list