RFR: 8294982: Implementation of Classfile API [v15]

Adam Sotona asotona at openjdk.org
Fri Feb 10 11:29:56 UTC 2023


On Thu, 9 Feb 2023 15:01:03 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   AttributeElement.Kind removal (#48)
>
> src/java.base/share/classes/jdk/internal/classfile/instruction/MonitorInstruction.java line 48:
> 
>> 46:      *           which must be of kind {@link Opcode.Kind#MONITOR}
>> 47:      */
>> 48:     static MonitorInstruction of(Opcode op) {
> 
> There are only two cases here - perhaps also offer factories for monitor enter/exit? Or is creating instruction models a rare operation (e.g. because when adapting you always also have a CodeBuilder which has the user-friendly methods?)

Each of the approaches server different purposes. `CodeBuilder` with user-friendly methods is my first choice when typing code from scratch, however in transformations you usually start with a pattern switch and it is a Classfile API "standard" to find relevant factory methods in each `Instruction` sub-type.

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

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



More information about the build-dev mailing list