Interface CodeBuilder
- All Superinterfaces:
- ClassFileBuilderPREVIEW<CodeElementPREVIEW,,- CodeBuilderPREVIEW> - Consumer<CodeElementPREVIEW>
- All Known Subinterfaces:
- CodeBuilder.BlockCodeBuilderPREVIEW
CodeBuilder is a preview API of the Java platform.
MethodBuilder.withCode(Consumer)PREVIEW or to code transforms.  The elements of a
 code can be specified abstractly, by passing a CodeElementPREVIEW to ClassFileBuilder.with(ClassFileElement)PREVIEW or concretely by calling the various withXxx
 methods.- Since:
- 22
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfacePreview.A builder for blocks of code.static interfacePreview.A builder to add catch blocks.
- 
Method SummaryModifier and TypeMethodDescriptiondefault CodeBuilderPREVIEWaaload()Generate an instruction to load a reference from an arraydefault CodeBuilderPREVIEWaastore()Generate an instruction to store into a reference arraydefault CodeBuilderPREVIEWGenerate an instruction pushing the null object reference onto the operand stackintallocateLocal(TypeKindPREVIEW typeKind) Returns the local variable slot of a fresh local variable.default CodeBuilderPREVIEWaload(int slot) Generate an instruction to load a reference from a local variabledefault CodeBuilderPREVIEWanewarray(ClassEntryPREVIEW classEntry) Generate an instruction to create a new array of referencedefault CodeBuilderPREVIEWGenerate an instruction to create a new array of referencedefault CodeBuilderPREVIEWareturn()Generate an instruction to return a reference from the methoddefault CodeBuilderPREVIEWGenerate an instruction to get length of an arraydefault CodeBuilderPREVIEWGenerate an instruction to load from an arraydefault CodeBuilderPREVIEWGenerate an instruction to store into an arraydefault CodeBuilderPREVIEWastore(int slot) Generate an instruction to store a reference into a local variabledefault CodeBuilderPREVIEWathrow()Generate an instruction to throw an exception or errordefault CodeBuilderPREVIEWbaload()Generate an instruction to load a byte from a arraydefault CodeBuilderPREVIEWbastore()Generate an instruction to store into a byte arraydefault CodeBuilderPREVIEWbipush(int b) Generate an instruction pushing a byte onto the operand stackdefault CodeBuilderPREVIEWblock(Consumer<CodeBuilder.BlockCodeBuilderPREVIEW> handler) Add a lexical block to the method being built.default CodeBuilderPREVIEWGenerate a branch instructiondefault CodeBuilderPREVIEWcaload()Generate an instruction to load a char from an arraydefault CodeBuilderPREVIEWcastore()Generate an instruction to store into a char arraydefault CodeBuilderPREVIEWcharacterRange(LabelPREVIEW startScope, LabelPREVIEW endScope, int characterRangeStart, int characterRangeEnd, int flags) Declare a character range entrydefault CodeBuilderPREVIEWcheckcast(ClassEntryPREVIEW type) Generate an instruction to check whether an object is of the given typedefault CodeBuilderPREVIEWGenerate an instruction to check whether an object is of the given typedefault CodeBuilderPREVIEWconversion(TypeKindPREVIEW fromType, TypeKindPREVIEW toType) Generate instruction(s) to convertfromTypetotoTypedefault CodeBuilderPREVIEWd2f()Generate an instruction to convert a double into a floatdefault CodeBuilderPREVIEWd2i()Generate an instruction to convert a double into an intdefault CodeBuilderPREVIEWd2l()Generate an instruction to convert a double into a longdefault CodeBuilderPREVIEWdadd()Generate an instruction to add a doubledefault CodeBuilderPREVIEWdaload()Generate an instruction to load a double from an arraydefault CodeBuilderPREVIEWdastore()Generate an instruction to store into a double arraydefault CodeBuilderPREVIEWdcmpg()Generate an instruction to add a doubledefault CodeBuilderPREVIEWdcmpl()Generate an instruction to compare doublesdefault CodeBuilderPREVIEWdconst_0()Generate an instruction pushing double constant 0 onto the operand stackdefault CodeBuilderPREVIEWdconst_1()Generate an instruction pushing double constant 1 onto the operand stackdefault CodeBuilderPREVIEWddiv()Generate an instruction to divide doublesdefault CodeBuilderPREVIEWdload(int slot) Generate an instruction to load a double from a local variabledefault CodeBuilderPREVIEWdmul()Generate an instruction to multiply doublesdefault CodeBuilderPREVIEWdneg()Generate an instruction to negate a doubledefault CodeBuilderPREVIEWdrem()Generate an instruction to calculate double remainderdefault CodeBuilderPREVIEWdreturn()Generate an instruction to return a double from the methoddefault CodeBuilderPREVIEWdstore(int slot) Generate an instruction to store a double into a local variabledefault CodeBuilderPREVIEWdsub()Generate an instruction to subtract doublesdefault CodeBuilderPREVIEWdup()Generate an instruction to duplicate the top operand stack valuedefault CodeBuilderPREVIEWdup_x1()Generate an instruction to duplicate the top operand stack value and insert two values downdefault CodeBuilderPREVIEWdup_x2()Generate an instruction to duplicate the top operand stack value and insert two or three values downdefault CodeBuilderPREVIEWdup2()Generate an instruction to duplicate the top one or two operand stack valuedefault CodeBuilderPREVIEWdup2_x1()Generate an instruction to duplicate the top one or two operand stack values and insert two or three values downdefault CodeBuilderPREVIEWdup2_x2()Generate an instruction to duplicate the top one or two operand stack values and insert two, three, or four values downendLabel()Returns the label associated with the end of the current block.default CodeBuilderPREVIEWexceptionCatch(LabelPREVIEW start, LabelPREVIEW end, LabelPREVIEW handler, ClassEntryPREVIEW catchType) Declare an exception table entrydefault CodeBuilderPREVIEWDeclare an exception table entrydefault CodeBuilderPREVIEWexceptionCatch(LabelPREVIEW start, LabelPREVIEW end, LabelPREVIEW handler, Optional<ClassEntryPREVIEW> catchType) Declare an exception table entrydefault CodeBuilderPREVIEWDeclare an exception table entry catching all exceptions and errorsdefault CodeBuilderPREVIEWf2d()Generate an instruction to convert a float into a doubledefault CodeBuilderPREVIEWf2i()Generate an instruction to convert a float into an intdefault CodeBuilderPREVIEWf2l()Generate an instruction to convert a float into a longdefault CodeBuilderPREVIEWfadd()Generate an instruction to add a floatdefault CodeBuilderPREVIEWfaload()Generate an instruction to load a float from an arraydefault CodeBuilderPREVIEWfastore()Generate an instruction to store into a float arraydefault CodeBuilderPREVIEWfcmpg()Generate an instruction to compare floatsdefault CodeBuilderPREVIEWfcmpl()Generate an instruction to compare floatsdefault CodeBuilderPREVIEWfconst_0()Generate an instruction pushing float constant 0 onto the operand stackdefault CodeBuilderPREVIEWfconst_1()Generate an instruction pushing float constant 1 onto the operand stackdefault CodeBuilderPREVIEWfconst_2()Generate an instruction pushing float constant 2 onto the operand stackdefault CodeBuilderPREVIEWfdiv()Generate an instruction to divide floatsdefault CodeBuilderPREVIEWfieldAccess(OpcodePREVIEW opcode, FieldRefEntryPREVIEW ref) Generate an instruction to access a fielddefault CodeBuilderPREVIEWGenerate an instruction to access a fielddefault CodeBuilderPREVIEWfload(int slot) Generate an instruction to load a float from a local variabledefault CodeBuilderPREVIEWfmul()Generate an instruction to multiply floatsdefault CodeBuilderPREVIEWfneg()Generate an instruction to negate a floatdefault CodeBuilderPREVIEWfrem()Generate an instruction to calculate floats remainderdefault CodeBuilderPREVIEWfreturn()Generate an instruction to return a float from the methoddefault CodeBuilderPREVIEWfstore(int slot) Generate an instruction to store a float into a local variabledefault CodeBuilderPREVIEWfsub()Generate an instruction to subtract floatsdefault CodeBuilderPREVIEWGenerate an instruction to fetch field from an objectdefault CodeBuilderPREVIEWGenerate an instruction to fetch field from an objectdefault CodeBuilderPREVIEWGenerate an instruction to get static field from a classdefault CodeBuilderPREVIEWGenerate an instruction to get static field from a classdefault CodeBuilderPREVIEWGenerate an instruction to branch alwaysdefault CodeBuilderPREVIEWGenerate an instruction to branch always with wide indexdefault CodeBuilderPREVIEWi2b()Generate an instruction to convert an int into a bytedefault CodeBuilderPREVIEWi2c()Generate an instruction to convert an int into a chardefault CodeBuilderPREVIEWi2d()Generate an instruction to convert an int into a doubledefault CodeBuilderPREVIEWi2f()Generate an instruction to convert an int into a floatdefault CodeBuilderPREVIEWi2l()Generate an instruction to convert an int into a longdefault CodeBuilderPREVIEWi2s()Generate an instruction to convert an int into a shortdefault CodeBuilderPREVIEWiadd()Generate an instruction to add an intdefault CodeBuilderPREVIEWiaload()Generate an instruction to load a int from an arraydefault CodeBuilderPREVIEWiand()Generate an instruction to calculate boolean AND of intsdefault CodeBuilderPREVIEWiastore()Generate an instruction to store into an int arraydefault CodeBuilderPREVIEWiconst_0()Generate an instruction pushing int constant 0 onto the operand stackdefault CodeBuilderPREVIEWiconst_1()Generate an instruction pushing int constant 1 onto the operand stackdefault CodeBuilderPREVIEWiconst_2()Generate an instruction pushing int constant 2 onto the operand stackdefault CodeBuilderPREVIEWiconst_3()Generate an instruction pushing int constant 3 onto the operand stackdefault CodeBuilderPREVIEWiconst_4()Generate an instruction pushing int constant 4 onto the operand stackdefault CodeBuilderPREVIEWiconst_5()Generate an instruction pushing int constant 5 onto the operand stackdefault CodeBuilderPREVIEWGenerate an instruction pushing int constant -1 onto the operand stackdefault CodeBuilderPREVIEWidiv()Generate an instruction to divide intsdefault CodeBuilderPREVIEWGenerate an instruction to branch if reference comparison succeedsdefault CodeBuilderPREVIEWGenerate an instruction to branch if reference comparison succeedsdefault CodeBuilderPREVIEWGenerate an instruction to branch if int comparison succeedsdefault CodeBuilderPREVIEWGenerate an instruction to branch if int comparison succeedsdefault CodeBuilderPREVIEWGenerate an instruction to branch if int comparison succeedsdefault CodeBuilderPREVIEWGenerate an instruction to branch if int comparison succeedsdefault CodeBuilderPREVIEWGenerate an instruction to branch if int comparison succeedsdefault CodeBuilderPREVIEWGenerate an instruction to branch if int comparison succeedsdefault CodeBuilderPREVIEWif_nonnull(LabelPREVIEW target) Generate an instruction to branch if reference is not nulldefault CodeBuilderPREVIEWGenerate an instruction to branch if reference is nulldefault CodeBuilderPREVIEWGenerate an instruction to branch if int comparison with zero succeedsdefault CodeBuilderPREVIEWGenerate an instruction to branch if int comparison with zero succeedsdefault CodeBuilderPREVIEWGenerate an instruction to branch if int comparison with zero succeedsdefault CodeBuilderPREVIEWGenerate an instruction to branch if int comparison with zero succeedsdefault CodeBuilderPREVIEWGenerate an instruction to branch if int comparison with zero succeedsdefault CodeBuilderPREVIEWGenerate an instruction to branch if int comparison with zero succeedsdefault CodeBuilderPREVIEWAdd an "if-then" block that is conditional on the value(s) on top of the operand stack in accordance with the given opcode.default CodeBuilderPREVIEWifThen(Consumer<CodeBuilder.BlockCodeBuilderPREVIEW> thenHandler) Add an "if-then" block that is conditional on the boolean value on top of the operand stack.default CodeBuilderPREVIEWifThenElse(OpcodePREVIEW opcode, Consumer<CodeBuilder.BlockCodeBuilderPREVIEW> thenHandler, Consumer<CodeBuilder.BlockCodeBuilderPREVIEW> elseHandler) Add an "if-then-else" block that is conditional on the value(s) on top of the operand stack in accordance with the given opcode.default CodeBuilderPREVIEWifThenElse(Consumer<CodeBuilder.BlockCodeBuilderPREVIEW> thenHandler, Consumer<CodeBuilder.BlockCodeBuilderPREVIEW> elseHandler) Add an "if-then-else" block that is conditional on the boolean value on top of the operand stack.default CodeBuilderPREVIEWiinc(int slot, int val) Generate an instruction to increment a local variable by a constantdefault CodeBuilderPREVIEWiload(int slot) Generate an instruction to load an int from a local variabledefault CodeBuilderPREVIEWimul()Generate an instruction to multiply intsdefault CodeBuilderPREVIEWineg()Generate an instruction to negate an intdefault CodeBuilderPREVIEWinstanceOf(ClassEntryPREVIEW target) Generate an instruction to determine if an object is of the given typedefault CodeBuilderPREVIEWinstanceOf(ClassDesc target) Generate an instruction to determine if an object is of the given typedefault CodeBuilderPREVIEWinvoke(OpcodePREVIEW opcode, MemberRefEntryPREVIEW ref) Generate an instruction to invoke a method or constructordefault CodeBuilderPREVIEWinvoke(OpcodePREVIEW opcode, ClassDesc owner, String name, MethodTypeDesc desc, boolean isInterface) Generate an instruction to invoke a method or constructordefault CodeBuilderPREVIEWGenerate an instruction to invoke a dynamically-computed call sitedefault CodeBuilderPREVIEWGenerate an instruction to invoke a dynamically-computed call sitedefault CodeBuilderPREVIEWGenerate an instruction to invoke an interface methoddefault CodeBuilderPREVIEWinvokeinterface(ClassDesc owner, String name, MethodTypeDesc type) Generate an instruction to invoke an interface methoddefault CodeBuilderPREVIEWGenerate an instruction to invoke an instance method; direct invocation of instance initialization methods and methods of the current class and its supertypesdefault CodeBuilderPREVIEWGenerate an instruction to invoke an instance method; direct invocation of instance initialization methods and methods of the current class and its supertypesdefault CodeBuilderPREVIEWinvokespecial(ClassDesc owner, String name, MethodTypeDesc type) Generate an instruction to invoke an instance method; direct invocation of instance initialization methods and methods of the current class and its supertypesdefault CodeBuilderPREVIEWinvokespecial(ClassDesc owner, String name, MethodTypeDesc type, boolean isInterface) Generate an instruction to invoke an instance method; direct invocation of instance initialization methods and methods of the current class and its supertypesdefault CodeBuilderPREVIEWGenerate an instruction to invoke a class (static) methoddefault CodeBuilderPREVIEWGenerate an instruction to invoke a class (static) methoddefault CodeBuilderPREVIEWinvokestatic(ClassDesc owner, String name, MethodTypeDesc type) Generate an instruction to invoke a class (static) methoddefault CodeBuilderPREVIEWinvokestatic(ClassDesc owner, String name, MethodTypeDesc type, boolean isInterface) Generate an instruction to invoke a class (static) methoddefault CodeBuilderPREVIEWGenerate an instruction to invoke an instance method; dispatch based on classdefault CodeBuilderPREVIEWinvokevirtual(ClassDesc owner, String name, MethodTypeDesc type) Generate an instruction to invoke an instance method; dispatch based on classdefault CodeBuilderPREVIEWior()Generate an instruction to calculate boolean OR of intsdefault CodeBuilderPREVIEWirem()Generate an instruction to calculate ints remainderdefault CodeBuilderPREVIEWireturn()Generate an instruction to return an int from the methoddefault CodeBuilderPREVIEWishl()Generate an instruction to shift an int leftdefault CodeBuilderPREVIEWishr()Generate an instruction to shift an int rightdefault CodeBuilderPREVIEWistore(int slot) Generate an instruction to store an int into a local variabledefault CodeBuilderPREVIEWisub()Generate an instruction to subtract intsdefault CodeBuilderPREVIEWiushr()Generate an instruction to logical shift an int rightdefault CodeBuilderPREVIEWixor()Generate an instruction to calculate boolean XOR of intsdefault CodeBuilderPREVIEWl2d()Generate an instruction to convert a long into a doubledefault CodeBuilderPREVIEWl2f()Generate an instruction to convert a long into a floatdefault CodeBuilderPREVIEWl2i()Generate an instruction to convert a long into an intdefault CodeBuilderPREVIEWlabelBinding(LabelPREVIEW label) Bind label with current positiondefault CodeBuilderPREVIEWladd()Generate an instruction to add a longdefault CodeBuilderPREVIEWlaload()Generate an instruction to load a long from an arraydefault CodeBuilderPREVIEWland()Generate an instruction to calculate boolean AND of longsdefault CodeBuilderPREVIEWlastore()Generate an instruction to store into a long arraydefault CodeBuilderPREVIEWlcmp()Generate an instruction to compare longsdefault CodeBuilderPREVIEWlconst_0()Generate an instruction pushing long constant 0 onto the operand stackdefault CodeBuilderPREVIEWlconst_1()Generate an instruction pushing long constant 1 onto the operand stackdefault CodeBuilderPREVIEWldc(LoadableConstantEntryPREVIEW entry) Generate an instruction pushing an item from the run-time constant pool onto the operand stackdefault CodeBuilderPREVIEWldc(ConstantDesc value) Generate an instruction pushing an item from the run-time constant pool onto the operand stackdefault CodeBuilderPREVIEWldiv()Generate an instruction to divide longsdefault CodeBuilderPREVIEWlineNumber(int line) Declare a source line number of the current builder positiondefault CodeBuilderPREVIEWlload(int slot) Generate an instruction to load a long from a local variabledefault CodeBuilderPREVIEWlmul()Generate an instruction to multiply longsdefault CodeBuilderPREVIEWlneg()Generate an instruction to negate a longdefault CodeBuilderPREVIEWloadConstant(OpcodePREVIEW opcode, ConstantDesc value) Generate an instruction pushing a constant onto the operand stackdefault CodeBuilderPREVIEWloadConstant(ConstantDesc value) Generate an instruction pushing a constant onto the operand stackdefault CodeBuilderPREVIEWGenerate an instruction to load a value from a local variabledefault CodeBuilderPREVIEWlocalVariable(int slot, Utf8EntryPREVIEW nameEntry, Utf8EntryPREVIEW descriptorEntry, LabelPREVIEW startScope, LabelPREVIEW endScope) Declare a local variable entrydefault CodeBuilderPREVIEWlocalVariable(int slot, String name, ClassDesc descriptor, LabelPREVIEW startScope, LabelPREVIEW endScope) Declare a local variable entrydefault CodeBuilderPREVIEWlocalVariableType(int slot, Utf8EntryPREVIEW nameEntry, Utf8EntryPREVIEW signatureEntry, LabelPREVIEW startScope, LabelPREVIEW endScope) Declare a local variable type entrydefault CodeBuilderPREVIEWlocalVariableType(int slot, String name, SignaturePREVIEW signature, LabelPREVIEW startScope, LabelPREVIEW endScope) Declare a local variable type entrydefault CodeBuilderPREVIEWlookupswitch(LabelPREVIEW defaultTarget, List<SwitchCasePREVIEW> cases) Generate an instruction to access a jump table by key match and jumpdefault CodeBuilderPREVIEWlor()Generate an instruction to calculate boolean OR of longsdefault CodeBuilderPREVIEWlrem()Generate an instruction to calculate longs remainderdefault CodeBuilderPREVIEWlreturn()Generate an instruction to return a long from the methoddefault CodeBuilderPREVIEWlshl()Generate an instruction to shift a long leftdefault CodeBuilderPREVIEWlshr()Generate an instruction to shift a long rightdefault CodeBuilderPREVIEWlstore(int slot) Generate an instruction to store a long into a local variabledefault CodeBuilderPREVIEWlsub()Generate an instruction to subtract longsdefault CodeBuilderPREVIEWlushr()Generate an instruction to logical shift a long leftdefault CodeBuilderPREVIEWlxor()Generate an instruction to calculate boolean XOR of longsdefault CodeBuilderPREVIEWGenerate an instruction to enter monitor for an objectdefault CodeBuilderPREVIEWGenerate an instruction to exit monitor for an objectdefault CodeBuilderPREVIEWmultianewarray(ClassEntryPREVIEW array, int dims) Generate an instruction to create a new multidimensional arraydefault CodeBuilderPREVIEWmultianewarray(ClassDesc array, int dims) Generate an instruction to create a new multidimensional arraydefault CodeBuilderPREVIEWnew_(ClassEntryPREVIEW clazz) Generate an instruction to create a new objectdefault CodeBuilderPREVIEWGenerate an instruction to create a new objectdefault CodeBuilderPREVIEWGenerate an instruction to create a new array of a primitive typeCreate new label bound with current positionnewLabel()Returns a fresh unbound label.default CodeBuilderPREVIEWnop()Generate a do nothing instructionoriginal()intparameterSlot(int paramNo) Returns the local variable slot associated with the specified parameter.default CodeBuilderPREVIEWpop()Generate an instruction to pop the top operand stack valuedefault CodeBuilderPREVIEWpop2()Generate an instruction to pop the top one or two operand stack valuesdefault CodeBuilderPREVIEWGenerate an instruction to set field in an objectdefault CodeBuilderPREVIEWGenerate an instruction to set field in an objectdefault CodeBuilderPREVIEWGenerate an instruction to set static field in a classdefault CodeBuilderPREVIEWGenerate an instruction to set static field in a classintReturns the local variable slot associated with the receiver.default CodeBuilderPREVIEWreturn_()Generate an instruction to return void from the methoddefault CodeBuilderPREVIEWGenerate return instructiondefault CodeBuilderPREVIEWsaload()Generate an instruction to load a short from an arraydefault CodeBuilderPREVIEWsastore()Generate an instruction to store into a short arraydefault CodeBuilderPREVIEWsipush(int s) Generate an instruction pushing a short onto the operand stackReturns the label associated with the beginning of the current block.default CodeBuilderPREVIEWstoreLocal(TypeKindPREVIEW tk, int slot) Generate an instruction to store a value to a local variabledefault CodeBuilderPREVIEWswap()Generate an instruction to swap the top two operand stack valuesdefault CodeBuilderPREVIEWtableswitch(int low, int high, LabelPREVIEW defaultTarget, List<SwitchCasePREVIEW> cases) Generate an instruction to access a jump table by index and jumpdefault CodeBuilderPREVIEWtableswitch(LabelPREVIEW defaultTarget, List<SwitchCasePREVIEW> cases) Generate an instruction to access a jump table by index and jumpdefault CodeBuilderPREVIEWtransforming(CodeTransformPREVIEW transform, Consumer<CodeBuilderPREVIEW> handler) Apply a transform to the code built by a handler, directing results to this builder.default CodeBuilderPREVIEWtrying(Consumer<CodeBuilder.BlockCodeBuilderPREVIEW> tryHandler, Consumer<CodeBuilder.CatchBuilderPREVIEW> catchesHandler) Adds a "try-catch" block comprising one try block and zero or more catch blocks.Methods declared in interface java.lang.classfile.ClassFileBuilderPREVIEWaccept, canWriteDirect, constantPool, transform, with
- 
Method Details- 
original
- 
newLabel
- 
startLabelReturns the label associated with the beginning of the current block. If the current CodeBuilderPREVIEW is not a "block" builder, such as those provided byblock(Consumer)orifThenElse(Consumer, Consumer), the current block will be the entire method body.- Returns:
- the label associated with the beginning of the current block
 
- 
endLabelReturns the label associated with the end of the current block. If the current CodeBuilderPREVIEW is not a "block" builder, such as those provided byblock(Consumer)orifThenElse(Consumer, Consumer), the current block will be the entire method body.- Returns:
- the label associated with the end of the current block
 
- 
receiverSlotint receiverSlot()Returns the local variable slot associated with the receiver..- Returns:
- the local variable slot associated with the receiver
- Throws:
- IllegalStateException- if this is not a static method
 
- 
parameterSlotint parameterSlot(int paramNo) Returns the local variable slot associated with the specified parameter.. The returned value is adjusted for the receiver slot (if the method is an instance method) and for the requirement thatlonganddoublevalues require two slots.- Parameters:
- paramNo- the index of the parameter
- Returns:
- the local variable slot associated with the specified parameter
 
- 
allocateLocalReturns the local variable slot of a fresh local variable. This method makes reasonable efforts to determine which slots are in use and which are not. When transforming a method, fresh locals begin at themaxLocalsof the original method. For a method being built directly, fresh locals begin after the last parameter slot.If the current code builder is a "block" code builder provided by block(Consumer),ifThen(Consumer), orifThenElse(Consumer, Consumer), at the end of the block, locals are reset to their value at the beginning of the block.- Parameters:
- typeKind- the type of the local variable
- Returns:
- the local variable slot of a fresh local variable
 
- 
transformingdefault CodeBuilderPREVIEW transforming(CodeTransformPREVIEW transform, Consumer<CodeBuilderPREVIEW> handler) Apply a transform to the code built by a handler, directing results to this builder.- Parameters:
- transform- the transform to apply to the code built by the handler
- handler- the handler that receives a CodeBuilderPREVIEW to build the code.
- Returns:
- this builder
 
- 
blockAdd a lexical block to the method being built.Within this block, the startLabel()andendLabel()correspond to the start and end of the block, and theCodeBuilder.BlockCodeBuilder.breakLabel()PREVIEW also corresponds to the end of the block.- Parameters:
- handler- handler that receives a CodeBuilder.BlockCodeBuilderPREVIEW to generate the body of the lexical block.
- Returns:
- this builder
 
- 
ifThenAdd an "if-then" block that is conditional on the boolean value on top of the operand stack.The CodeBuilder.BlockCodeBuilder.breakLabel()PREVIEW for the "then" block corresponds to the end of that block.- Parameters:
- thenHandler- handler that receives a CodeBuilder.BlockCodeBuilderPREVIEW to generate the body of the- if
- Returns:
- this builder
 
- 
ifThendefault CodeBuilderPREVIEW ifThen(OpcodePREVIEW opcode, Consumer<CodeBuilder.BlockCodeBuilderPREVIEW> thenHandler) Add an "if-then" block that is conditional on the value(s) on top of the operand stack in accordance with the given opcode.The CodeBuilder.BlockCodeBuilder.breakLabel()PREVIEW for the "then" block corresponds to the end of that block.- Parameters:
- opcode- the operation code for a branch instructions that accepts one or two operands on the stack
- thenHandler- handler that receives a CodeBuilder.BlockCodeBuilderPREVIEW to generate the body of the- if
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if the operation code is not for a branch instruction that accepts one or two operands
 
- 
ifThenElsedefault CodeBuilderPREVIEW ifThenElse(Consumer<CodeBuilder.BlockCodeBuilderPREVIEW> thenHandler, Consumer<CodeBuilder.BlockCodeBuilderPREVIEW> elseHandler) Add an "if-then-else" block that is conditional on the boolean value on top of the operand stack.The CodeBuilder.BlockCodeBuilder.breakLabel()PREVIEW for each block corresponds to the end of the "else" block.- Parameters:
- thenHandler- handler that receives a CodeBuilder.BlockCodeBuilderPREVIEW to generate the body of the- if
- elseHandler- handler that receives a CodeBuilder.BlockCodeBuilderPREVIEW to generate the body of the- else
- Returns:
- this builder
 
- 
ifThenElsedefault CodeBuilderPREVIEW ifThenElse(OpcodePREVIEW opcode, Consumer<CodeBuilder.BlockCodeBuilderPREVIEW> thenHandler, Consumer<CodeBuilder.BlockCodeBuilderPREVIEW> elseHandler) Add an "if-then-else" block that is conditional on the value(s) on top of the operand stack in accordance with the given opcode.The CodeBuilder.BlockCodeBuilder.breakLabel()PREVIEW for each block corresponds to the end of the "else" block.- Parameters:
- opcode- the operation code for a branch instructions that accepts one or two operands on the stack
- thenHandler- handler that receives a CodeBuilder.BlockCodeBuilderPREVIEW to generate the body of the- if
- elseHandler- handler that receives a CodeBuilder.BlockCodeBuilderPREVIEW to generate the body of the- else
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if the operation code is not for a branch instruction that accepts one or two operands
 
- 
tryingdefault CodeBuilderPREVIEW trying(Consumer<CodeBuilder.BlockCodeBuilderPREVIEW> tryHandler, Consumer<CodeBuilder.CatchBuilderPREVIEW> catchesHandler) Adds a "try-catch" block comprising one try block and zero or more catch blocks. Exceptions thrown by instructions in the try block may be caught by catch blocks.- Parameters:
- tryHandler- handler that receives a CodeBuilderPREVIEW to generate the body of the try block.
- catchesHandler- a handler that receives a CodeBuilder.CatchBuilderPREVIEW to generate bodies of catch blocks.
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if the try block is empty.
- See Also:
 
- 
loadLocalGenerate an instruction to load a value from a local variable- Parameters:
- tk- the load type
- slot- the local variable slot
- Returns:
- this builder
- Since:
- 23
 
- 
storeLocalGenerate an instruction to store a value to a local variable- Parameters:
- tk- the store type
- slot- the local variable slot
- Returns:
- this builder
- Since:
- 23
 
- 
branch
- 
return_Generate return instruction- Parameters:
- tk- the return type
- Returns:
- this builder
- Since:
- 23
 
- 
fieldAccessGenerate an instruction to access a field- Parameters:
- opcode- the field access opcode
- ref- the field reference
- Returns:
- this builder
- Since:
- 23
- See Also:
 
- 
fieldAccess
- 
invokeGenerate an instruction to invoke a method or constructor- Parameters:
- opcode- the invoke opcode
- ref- the interface method or method reference
- Returns:
- this builder
- Since:
- 23
- See Also:
 
- 
invokedefault CodeBuilderPREVIEW invoke(OpcodePREVIEW opcode, ClassDesc owner, String name, MethodTypeDesc desc, boolean isInterface) Generate an instruction to invoke a method or constructor- Parameters:
- opcode- the invoke opcode
- owner- the class
- name- the method name
- desc- the method type
- isInterface- the interface method invocation indication
- Returns:
- this builder
- Since:
- 23
- See Also:
 
- 
arrayLoadGenerate an instruction to load from an array- Parameters:
- tk- the array element type
- Returns:
- this builder
- Since:
- 23
 
- 
arrayStoreGenerate an instruction to store into an array- Parameters:
- tk- the array element type
- Returns:
- this builder
- Since:
- 23
 
- 
conversionGenerate instruction(s) to convertfromTypetotoType- Parameters:
- fromType- the source type
- toType- the target type
- Returns:
- this builder
- Throws:
- IllegalArgumentException- for conversions of- VoidTypeor- ReferenceType
- Since:
- 23
 
- 
loadConstantGenerate an instruction pushing a constant onto the operand stack- Parameters:
- opcode- the constant instruction opcode
- value- the constant value
- Returns:
- this builder
- Since:
- 23
- See Also:
 
- 
loadConstantGenerate an instruction pushing a constant onto the operand stack- Parameters:
- value- the constant value
- Returns:
- this builder
- Since:
- 23
 
- 
nop
- 
newBoundLabel
- 
labelBindingBind label with current position- Parameters:
- label- the label
- Returns:
- this builder
 
- 
lineNumberDeclare a source line number of the current builder position- Parameters:
- line- the line number
- Returns:
- this builder
 
- 
exceptionCatchdefault CodeBuilderPREVIEW exceptionCatch(LabelPREVIEW start, LabelPREVIEW end, LabelPREVIEW handler, ClassEntryPREVIEW catchType) Declare an exception table entry- Parameters:
- start- the try block start
- end- the try block end
- handler- the exception handler start
- catchType- the catch type or null to catch all exceptions and errors
- Returns:
- this builder
 
- 
exceptionCatchdefault CodeBuilderPREVIEW exceptionCatch(LabelPREVIEW start, LabelPREVIEW end, LabelPREVIEW handler, Optional<ClassEntryPREVIEW> catchType) Declare an exception table entry- Parameters:
- start- the try block start
- end- the try block end
- handler- the exception handler start
- catchType- the optional catch type, empty to catch all exceptions and errors
- Returns:
- this builder
 
- 
exceptionCatchdefault CodeBuilderPREVIEW exceptionCatch(LabelPREVIEW start, LabelPREVIEW end, LabelPREVIEW handler, ClassDesc catchType) Declare an exception table entry- Parameters:
- start- the try block start
- end- the try block end
- handler- the exception handler start
- catchType- the catch type
- Returns:
- this builder
 
- 
exceptionCatchAll
- 
characterRangedefault CodeBuilderPREVIEW characterRange(LabelPREVIEW startScope, LabelPREVIEW endScope, int characterRangeStart, int characterRangeEnd, int flags) Declare a character range entry- Parameters:
- startScope- the start scope of the character range
- endScope- the end scope of the character range
- characterRangeStart- the encoded start of the character range region (inclusive)
- characterRangeEnd- the encoded end of the character range region (exclusive)
- flags- the flags word, indicating the kind of range
- Returns:
- this builder
 
- 
localVariabledefault CodeBuilderPREVIEW localVariable(int slot, Utf8EntryPREVIEW nameEntry, Utf8EntryPREVIEW descriptorEntry, LabelPREVIEW startScope, LabelPREVIEW endScope) Declare a local variable entry- Parameters:
- slot- the local variable slot
- nameEntry- the variable name
- descriptorEntry- the variable descriptor
- startScope- the start scope of the variable
- endScope- the end scope of the variable
- Returns:
- this builder
 
- 
localVariabledefault CodeBuilderPREVIEW localVariable(int slot, String name, ClassDesc descriptor, LabelPREVIEW startScope, LabelPREVIEW endScope) Declare a local variable entry- Parameters:
- slot- the local variable slot
- name- the variable name
- descriptor- the variable descriptor
- startScope- the start scope of the variable
- endScope- the end scope of the variable
- Returns:
- this builder
 
- 
localVariableTypedefault CodeBuilderPREVIEW localVariableType(int slot, Utf8EntryPREVIEW nameEntry, Utf8EntryPREVIEW signatureEntry, LabelPREVIEW startScope, LabelPREVIEW endScope) Declare a local variable type entry- Parameters:
- slot- the local variable slot
- nameEntry- the variable name
- signatureEntry- the variable signature
- startScope- the start scope of the variable
- endScope- the end scope of the variable
- Returns:
- this builder
 
- 
localVariableTypedefault CodeBuilderPREVIEW localVariableType(int slot, String name, SignaturePREVIEW signature, LabelPREVIEW startScope, LabelPREVIEW endScope) Declare a local variable type entry- Parameters:
- slot- the local variable slot
- name- the variable name
- signature- the variable signature
- startScope- the start scope of the variable
- endScope- the end scope of the variable
- Returns:
- this builder
 
- 
aconst_nullGenerate an instruction pushing the null object reference onto the operand stack- Returns:
- this builder
 
- 
aaloadGenerate an instruction to load a reference from an array- Returns:
- this builder
 
- 
aastoreGenerate an instruction to store into a reference array- Returns:
- this builder
 
- 
aloadGenerate an instruction to load a reference from a local variable- Parameters:
- slot- the local variable slot
- Returns:
- this builder
 
- 
anewarrayGenerate an instruction to create a new array of reference- Parameters:
- classEntry- the component type
- Returns:
- this builder
 
- 
anewarrayGenerate an instruction to create a new array of reference- Parameters:
- className- the component type
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if- classNamerepresents a primitive type
 
- 
areturnGenerate an instruction to return a reference from the method- Returns:
- this builder
 
- 
arraylengthGenerate an instruction to get length of an array- Returns:
- this builder
 
- 
astoreGenerate an instruction to store a reference into a local variable- Parameters:
- slot- the local variable slot
- Returns:
- this builder
 
- 
athrowGenerate an instruction to throw an exception or error- Returns:
- this builder
 
- 
baloadGenerate an instruction to load a byte from a array- Returns:
- this builder
 
- 
bastoreGenerate an instruction to store into a byte array- Returns:
- this builder
 
- 
bipushGenerate an instruction pushing a byte onto the operand stack- Parameters:
- b- the byte
- Returns:
- this builder
 
- 
caloadGenerate an instruction to load a char from an array- Returns:
- this builder
 
- 
castoreGenerate an instruction to store into a char array- Returns:
- this builder
 
- 
checkcastGenerate an instruction to check whether an object is of the given type- Parameters:
- type- the object type
- Returns:
- this builder
 
- 
checkcastGenerate an instruction to check whether an object is of the given type- Parameters:
- type- the object type
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if- typerepresents a primitive type
 
- 
d2fGenerate an instruction to convert a double into a float- Returns:
- this builder
 
- 
d2iGenerate an instruction to convert a double into an int- Returns:
- this builder
 
- 
d2lGenerate an instruction to convert a double into a long- Returns:
- this builder
 
- 
dadd
- 
daloadGenerate an instruction to load a double from an array- Returns:
- this builder
 
- 
dastoreGenerate an instruction to store into a double array- Returns:
- this builder
 
- 
dcmpg
- 
dcmpl
- 
dconst_0Generate an instruction pushing double constant 0 onto the operand stack- Returns:
- this builder
 
- 
dconst_1Generate an instruction pushing double constant 1 onto the operand stack- Returns:
- this builder
 
- 
ddiv
- 
dloadGenerate an instruction to load a double from a local variable- Parameters:
- slot- the local variable slot
- Returns:
- this builder
 
- 
dmul
- 
dneg
- 
dremGenerate an instruction to calculate double remainder- Returns:
- this builder
 
- 
dreturnGenerate an instruction to return a double from the method- Returns:
- this builder
 
- 
dstoreGenerate an instruction to store a double into a local variable- Parameters:
- slot- the local variable slot
- Returns:
- this builder
 
- 
dsub
- 
dupGenerate an instruction to duplicate the top operand stack value- Returns:
- this builder
 
- 
dup2Generate an instruction to duplicate the top one or two operand stack value- Returns:
- this builder
 
- 
dup2_x1Generate an instruction to duplicate the top one or two operand stack values and insert two or three values down- Returns:
- this builder
 
- 
dup2_x2Generate an instruction to duplicate the top one or two operand stack values and insert two, three, or four values down- Returns:
- this builder
 
- 
dup_x1Generate an instruction to duplicate the top operand stack value and insert two values down- Returns:
- this builder
 
- 
dup_x2Generate an instruction to duplicate the top operand stack value and insert two or three values down- Returns:
- this builder
 
- 
f2dGenerate an instruction to convert a float into a double- Returns:
- this builder
 
- 
f2iGenerate an instruction to convert a float into an int- Returns:
- this builder
 
- 
f2lGenerate an instruction to convert a float into a long- Returns:
- this builder
 
- 
fadd
- 
faloadGenerate an instruction to load a float from an array- Returns:
- this builder
 
- 
fastoreGenerate an instruction to store into a float array- Returns:
- this builder
 
- 
fcmpg
- 
fcmpl
- 
fconst_0Generate an instruction pushing float constant 0 onto the operand stack- Returns:
- this builder
 
- 
fconst_1Generate an instruction pushing float constant 1 onto the operand stack- Returns:
- this builder
 
- 
fconst_2Generate an instruction pushing float constant 2 onto the operand stack- Returns:
- this builder
 
- 
fdiv
- 
floadGenerate an instruction to load a float from a local variable- Parameters:
- slot- the local variable slot
- Returns:
- this builder
 
- 
fmul
- 
fneg
- 
fremGenerate an instruction to calculate floats remainder- Returns:
- this builder
 
- 
freturnGenerate an instruction to return a float from the method- Returns:
- this builder
 
- 
fstoreGenerate an instruction to store a float into a local variable- Parameters:
- slot- the local variable slot
- Returns:
- this builder
 
- 
fsub
- 
getfieldGenerate an instruction to fetch field from an object- Parameters:
- ref- the field reference
- Returns:
- this builder
 
- 
getfieldGenerate an instruction to fetch field from an object- Parameters:
- owner- the owner class
- name- the field name
- type- the field type
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if- ownerrepresents a primitive type
 
- 
getstaticGenerate an instruction to get static field from a class- Parameters:
- ref- the field reference
- Returns:
- this builder
 
- 
getstaticGenerate an instruction to get static field from a class- Parameters:
- owner- the owner class
- name- the field name
- type- the field type
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if- ownerrepresents a primitive type
 
- 
goto_Generate an instruction to branch always- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
goto_wGenerate an instruction to branch always with wide index- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
i2bGenerate an instruction to convert an int into a byte- Returns:
- this builder
 
- 
i2cGenerate an instruction to convert an int into a char- Returns:
- this builder
 
- 
i2dGenerate an instruction to convert an int into a double- Returns:
- this builder
 
- 
i2fGenerate an instruction to convert an int into a float- Returns:
- this builder
 
- 
i2lGenerate an instruction to convert an int into a long- Returns:
- this builder
 
- 
i2sGenerate an instruction to convert an int into a short- Returns:
- this builder
 
- 
iadd
- 
ialoadGenerate an instruction to load a int from an array- Returns:
- this builder
 
- 
iandGenerate an instruction to calculate boolean AND of ints- Returns:
- this builder
 
- 
iastoreGenerate an instruction to store into an int array- Returns:
- this builder
 
- 
iconst_0Generate an instruction pushing int constant 0 onto the operand stack- Returns:
- this builder
 
- 
iconst_1Generate an instruction pushing int constant 1 onto the operand stack- Returns:
- this builder
 
- 
iconst_2Generate an instruction pushing int constant 2 onto the operand stack- Returns:
- this builder
 
- 
iconst_3Generate an instruction pushing int constant 3 onto the operand stack- Returns:
- this builder
 
- 
iconst_4Generate an instruction pushing int constant 4 onto the operand stack- Returns:
- this builder
 
- 
iconst_5Generate an instruction pushing int constant 5 onto the operand stack- Returns:
- this builder
 
- 
iconst_m1Generate an instruction pushing int constant -1 onto the operand stack- Returns:
- this builder
 
- 
idiv
- 
if_acmpeqGenerate an instruction to branch if reference comparison succeeds- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
if_acmpneGenerate an instruction to branch if reference comparison succeeds- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
if_icmpeqGenerate an instruction to branch if int comparison succeeds- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
if_icmpgeGenerate an instruction to branch if int comparison succeeds- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
if_icmpgtGenerate an instruction to branch if int comparison succeeds- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
if_icmpleGenerate an instruction to branch if int comparison succeeds- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
if_icmpltGenerate an instruction to branch if int comparison succeeds- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
if_icmpneGenerate an instruction to branch if int comparison succeeds- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
if_nonnullGenerate an instruction to branch if reference is not null- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
if_nullGenerate an instruction to branch if reference is null- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
ifeqGenerate an instruction to branch if int comparison with zero succeeds- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
ifgeGenerate an instruction to branch if int comparison with zero succeeds- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
ifgtGenerate an instruction to branch if int comparison with zero succeeds- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
ifleGenerate an instruction to branch if int comparison with zero succeeds- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
ifltGenerate an instruction to branch if int comparison with zero succeeds- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
ifneGenerate an instruction to branch if int comparison with zero succeeds- Parameters:
- target- the branch target
- Returns:
- this builder
 
- 
iincGenerate an instruction to increment a local variable by a constant- Parameters:
- slot- the local variable slot
- val- the increment value
- Returns:
- this builder
 
- 
iloadGenerate an instruction to load an int from a local variable- Parameters:
- slot- the local variable slot
- Returns:
- this builder
 
- 
imul
- 
ineg
- 
instanceOfGenerate an instruction to determine if an object is of the given type- Parameters:
- target- the target type
- Returns:
- this builder
- Since:
- 23
 
- 
instanceOfGenerate an instruction to determine if an object is of the given type- Parameters:
- target- the target type
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if- targetrepresents a primitive type
- Since:
- 23
 
- 
invokedynamicGenerate an instruction to invoke a dynamically-computed call site- Parameters:
- ref- the dynamic call site
- Returns:
- this builder
 
- 
invokedynamicGenerate an instruction to invoke a dynamically-computed call site- Parameters:
- ref- the dynamic call site
- Returns:
- this builder
 
- 
invokeinterfaceGenerate an instruction to invoke an interface method- Parameters:
- ref- the interface method reference
- Returns:
- this builder
 
- 
invokeinterfaceGenerate an instruction to invoke an interface method- Parameters:
- owner- the owner class
- name- the method name
- type- the method type
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if- ownerrepresents a primitive type
 
- 
invokespecialGenerate an instruction to invoke an instance method; direct invocation of instance initialization methods and methods of the current class and its supertypes- Parameters:
- ref- the interface method reference
- Returns:
- this builder
 
- 
invokespecialGenerate an instruction to invoke an instance method; direct invocation of instance initialization methods and methods of the current class and its supertypes- Parameters:
- ref- the method reference
- Returns:
- this builder
 
- 
invokespecialGenerate an instruction to invoke an instance method; direct invocation of instance initialization methods and methods of the current class and its supertypes- Parameters:
- owner- the owner class
- name- the method name
- type- the method type
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if- ownerrepresents a primitive type
 
- 
invokespecialdefault CodeBuilderPREVIEW invokespecial(ClassDesc owner, String name, MethodTypeDesc type, boolean isInterface) Generate an instruction to invoke an instance method; direct invocation of instance initialization methods and methods of the current class and its supertypes- Parameters:
- owner- the owner class
- name- the method name
- type- the method type
- isInterface- the interface method invocation indication
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if- ownerrepresents a primitive type
 
- 
invokestaticGenerate an instruction to invoke a class (static) method- Parameters:
- ref- the interface method reference
- Returns:
- this builder
 
- 
invokestaticGenerate an instruction to invoke a class (static) method- Parameters:
- ref- the method reference
- Returns:
- this builder
 
- 
invokestaticGenerate an instruction to invoke a class (static) method- Parameters:
- owner- the owner class
- name- the method name
- type- the method type
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if- ownerrepresents a primitive type
 
- 
invokestaticdefault CodeBuilderPREVIEW invokestatic(ClassDesc owner, String name, MethodTypeDesc type, boolean isInterface) Generate an instruction to invoke a class (static) method- Parameters:
- owner- the owner class
- name- the method name
- type- the method type
- isInterface- the interface method invocation indication
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if- ownerrepresents a primitive type
 
- 
invokevirtualGenerate an instruction to invoke an instance method; dispatch based on class- Parameters:
- ref- the method reference
- Returns:
- this builder
 
- 
invokevirtualGenerate an instruction to invoke an instance method; dispatch based on class- Parameters:
- owner- the owner class
- name- the method name
- type- the method type
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if- ownerrepresents a primitive type
 
- 
iorGenerate an instruction to calculate boolean OR of ints- Returns:
- this builder
 
- 
iremGenerate an instruction to calculate ints remainder- Returns:
- this builder
 
- 
ireturnGenerate an instruction to return an int from the method- Returns:
- this builder
 
- 
ishlGenerate an instruction to shift an int left- Returns:
- this builder
 
- 
ishrGenerate an instruction to shift an int right- Returns:
- this builder
 
- 
istoreGenerate an instruction to store an int into a local variable- Parameters:
- slot- the local variable slot
- Returns:
- this builder
 
- 
isub
- 
iushrGenerate an instruction to logical shift an int right- Returns:
- this builder
 
- 
ixorGenerate an instruction to calculate boolean XOR of ints- Returns:
- this builder
 
- 
lookupswitchGenerate an instruction to access a jump table by key match and jump- Parameters:
- defaultTarget- the default jump target
- cases- the switch cases
- Returns:
- this builder
 
- 
l2dGenerate an instruction to convert a long into a double- Returns:
- this builder
 
- 
l2fGenerate an instruction to convert a long into a float- Returns:
- this builder
 
- 
l2iGenerate an instruction to convert a long into an int- Returns:
- this builder
 
- 
ladd
- 
laloadGenerate an instruction to load a long from an array- Returns:
- this builder
 
- 
landGenerate an instruction to calculate boolean AND of longs- Returns:
- this builder
 
- 
lastoreGenerate an instruction to store into a long array- Returns:
- this builder
 
- 
lcmp
- 
lconst_0Generate an instruction pushing long constant 0 onto the operand stack- Returns:
- this builder
 
- 
lconst_1Generate an instruction pushing long constant 1 onto the operand stack- Returns:
- this builder
 
- 
ldcGenerate an instruction pushing an item from the run-time constant pool onto the operand stack- Parameters:
- value- the constant value
- Returns:
- this builder
 
- 
ldcGenerate an instruction pushing an item from the run-time constant pool onto the operand stack- Parameters:
- entry- the constant value
- Returns:
- this builder
 
- 
ldiv
- 
lloadGenerate an instruction to load a long from a local variable- Parameters:
- slot- the local variable slot
- Returns:
- this builder
 
- 
lmul
- 
lneg
- 
lorGenerate an instruction to calculate boolean OR of longs- Returns:
- this builder
 
- 
lremGenerate an instruction to calculate longs remainder- Returns:
- this builder
 
- 
lreturnGenerate an instruction to return a long from the method- Returns:
- this builder
 
- 
lshlGenerate an instruction to shift a long left- Returns:
- this builder
 
- 
lshrGenerate an instruction to shift a long right- Returns:
- this builder
 
- 
lstoreGenerate an instruction to store a long into a local variable- Parameters:
- slot- the local variable slot
- Returns:
- this builder
 
- 
lsub
- 
lushrGenerate an instruction to logical shift a long left- Returns:
- this builder
 
- 
lxorGenerate an instruction to calculate boolean XOR of longs- Returns:
- this builder
 
- 
monitorenterGenerate an instruction to enter monitor for an object- Returns:
- this builder
 
- 
monitorexitGenerate an instruction to exit monitor for an object- Returns:
- this builder
 
- 
multianewarrayGenerate an instruction to create a new multidimensional array- Parameters:
- array- the array type
- dims- the number of dimensions
- Returns:
- this builder
 
- 
multianewarrayGenerate an instruction to create a new multidimensional array- Parameters:
- array- the array type
- dims- the number of dimensions
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if- arrayrepresents a primitive type
 
- 
new_Generate an instruction to create a new object- Parameters:
- clazz- the new class type
- Returns:
- this builder
 
- 
new_Generate an instruction to create a new object- Parameters:
- clazz- the new class type
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if- clazzrepresents a primitive type
 
- 
newarrayGenerate an instruction to create a new array of a primitive type- Parameters:
- typeKind- the primitive array type
- Returns:
- this builder
 
- 
popGenerate an instruction to pop the top operand stack value- Returns:
- this builder
 
- 
pop2Generate an instruction to pop the top one or two operand stack values- Returns:
- this builder
 
- 
putfieldGenerate an instruction to set field in an object- Parameters:
- ref- the field reference
- Returns:
- this builder
 
- 
putfieldGenerate an instruction to set field in an object- Parameters:
- owner- the owner class
- name- the field name
- type- the field type
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if- ownerrepresents a primitive type
 
- 
putstaticGenerate an instruction to set static field in a class- Parameters:
- ref- the field reference
- Returns:
- this builder
 
- 
putstaticGenerate an instruction to set static field in a class- Parameters:
- owner- the owner class
- name- the field name
- type- the field type
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if- ownerrepresents a primitive type
 
- 
return_Generate an instruction to return void from the method- Returns:
- this builder
 
- 
saloadGenerate an instruction to load a short from an array- Returns:
- this builder
 
- 
sastoreGenerate an instruction to store into a short array- Returns:
- this builder
 
- 
sipushGenerate an instruction pushing a short onto the operand stack- Parameters:
- s- the short
- Returns:
- this builder
 
- 
swapGenerate an instruction to swap the top two operand stack values- Returns:
- this builder
 
- 
tableswitchdefault CodeBuilderPREVIEW tableswitch(int low, int high, LabelPREVIEW defaultTarget, List<SwitchCasePREVIEW> cases) Generate an instruction to access a jump table by index and jump- Parameters:
- low- the low key value
- high- the high key value
- defaultTarget- the default jump target
- cases- the switch cases
- Returns:
- this builder
 
- 
tableswitchGenerate an instruction to access a jump table by index and jump- Parameters:
- defaultTarget- the default jump target
- cases- the switch cases
- Returns:
- this builder
 
 
- 
CodeBuilderwhen preview features are enabled.