Class BytecodeMethod
- java.lang.Object
-
- org.eolang.jeo.representation.bytecode.BytecodeMethod
-
public final class BytecodeMethod extends Object
Bytecode method.- Since:
- 0.1.0
-
-
Constructor Summary
Constructors Constructor Description BytecodeMethod()
Constructor for tests.BytecodeMethod(String name)
Constructor.BytecodeMethod(String name, BytecodeAnnotations annotations)
Constructor.BytecodeMethod(String name, BytecodeMaxs maxs)
Constructor.BytecodeMethod(List<BytecodeEntry> tryblocks, List<BytecodeEntry> instructions, BytecodeAnnotations annotations, BytecodeMethodProperties properties, List<BytecodeDefaultValue> defvalues, BytecodeMaxs maxs, BytecodeAttributes attributes)
Constructor.BytecodeMethod(BytecodeEntry... instructions)
Constructor.BytecodeMethod(BytecodeMethodProperties properties, BytecodeMaxs maxs)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BytecodeMethod
defvalue(BytecodeDefaultValue defvalue)
Add default value.DirectivesMethod
directives(int number)
Generate directives.DirectivesMethod
directives(int number, Format format)
Generate directives.BytecodeMethod
entry(BytecodeEntry entry)
Add some bytecode entry.List<BytecodeEntry>
instructions()
Method instructions.BytecodeMethod
label(String label)
Add label.String
name()
Method name.BytecodeMethod
trycatch(BytecodeEntry entry)
Add try-catch block.BytecodeMethod
withoutMaxs()
Similar method without maxs.
-
-
-
Constructor Detail
-
BytecodeMethod
public BytecodeMethod()
Constructor for tests.
-
BytecodeMethod
public BytecodeMethod(String name)
Constructor.- Parameters:
name
- Method name.
-
BytecodeMethod
public BytecodeMethod(BytecodeEntry... instructions)
Constructor.- Parameters:
instructions
- Method instructions.
-
BytecodeMethod
public BytecodeMethod(String name, BytecodeAnnotations annotations)
Constructor.- Parameters:
name
- Method name.annotations
- Method annotations.
-
BytecodeMethod
public BytecodeMethod(String name, BytecodeMaxs maxs)
Constructor.- Parameters:
name
- Method name.maxs
- Max stack and locals.
-
BytecodeMethod
public BytecodeMethod(BytecodeMethodProperties properties, BytecodeMaxs maxs)
Constructor.- Parameters:
properties
- Method properties.maxs
- Max stack and locals.- Suppressed Checkstyle violations:
- ParameterNumberCheck (10 lines)
-
BytecodeMethod
public BytecodeMethod(List<BytecodeEntry> tryblocks, List<BytecodeEntry> instructions, BytecodeAnnotations annotations, BytecodeMethodProperties properties, List<BytecodeDefaultValue> defvalues, BytecodeMaxs maxs, BytecodeAttributes attributes)
Constructor.- Parameters:
tryblocks
- Try-catch blocks.instructions
- Method instructions.annotations
- Method annotations.properties
- Method properties.defvalues
- Default values.maxs
- Max stack and locals.attributes
- Method attributes.- Suppressed Checkstyle violations:
- ParameterNumberCheck (10 lines)
-
-
Method Detail
-
withoutMaxs
public BytecodeMethod withoutMaxs()
Similar method without maxs.- Returns:
- Method without maxs.
-
label
public BytecodeMethod label(String label)
Add label.- Parameters:
label
- Label.- Returns:
- This object.
-
trycatch
public BytecodeMethod trycatch(BytecodeEntry entry)
Add try-catch block.- Parameters:
entry
- Try-catch block.- Returns:
- This object.
-
entry
public BytecodeMethod entry(BytecodeEntry entry)
Add some bytecode entry.- Parameters:
entry
- Entry.- Returns:
- This object.
-
defvalue
public BytecodeMethod defvalue(BytecodeDefaultValue defvalue)
Add default value.- Parameters:
defvalue
- Default value.- Returns:
- This object.
-
name
public String name()
Method name.- Returns:
- Method name.
-
instructions
public List<BytecodeEntry> instructions()
Method instructions.- Returns:
- Instructions.
-
directives
public DirectivesMethod directives(int number)
Generate directives. Since EO can't have overloaded methods, we need to add suffix to their names. This suffix is a number of the method. For example, if we have two methods with the same name, say 'foo', then we add suffixes to their names: foo and foo-2. That is why we need to pass method number to this method.- Parameters:
number
- Method number.- Returns:
- Directives.
-
directives
public DirectivesMethod directives(int number, Format format)
Generate directives. Since EO can't have overloaded methods, we need to add suffix to their names. This suffix is a number of the method. For example, if we have two methods with the same name, say 'foo', then we add suffixes to their names: foo and foo-2. That is why we need to pass method number to this method.- Parameters:
number
- Method number.format
- Format of directives.- Returns:
- Directives.
-
-