On Thu, 9 Feb 2023 15:01:03 GMT, Maurizio Cimadamore <mcimadam...@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

Reply via email to