net.janino
Class Java.BlockStatement
java.lang.Object
|
+--net.janino.Java.Located
|
+--net.janino.Java.BlockStatement
- All Implemented Interfaces:
- Java.Locatable
- Direct Known Subclasses:
- Java.Statement
- Enclosing class:
- Java
- public abstract static class Java.BlockStatement
- extends net.janino.Java.Located
Base of all statements that can appear in a block.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Java.BlockStatement
public Java.BlockStatement(Scanner.Location location)
generatesCode
public abstract boolean generatesCode()
throws Java.CompileException
- Check whether invocation of
compile()
would
generate more than zero code bytes.
compile
public abstract boolean compile()
throws Java.CompileException
- Returns:
- false if this statement cannot complete normally (14.20)
leave
public abstract void leave(IClass optionalStackValueType)
- Clean up the statement context. This is currently relevant for
"try ... catch ... finally" statements (execute "finally" clause)
and "synchronized" statements (monitorexit).
Statements like "return", "break", "continue" must call this method
for all the statements they terminate.
Notice: If optionalStackValueType
is null
,
then the operand stack is empty; otherwise exactly one operand with that
type is on the stack. This information is vital to implementations of
leave(IClass)
that require a specific
operand stack state (e.g. an empty operand stack for JSR).
createDummyCodeAttribute
public ClassFile.CodeAttribute createDummyCodeAttribute()
getLocation
public Scanner.Location getLocation()
- Specified by:
getLocation
in interface Java.Locatable
throwParseException
public void throwParseException(java.lang.String message)
throws Parser.ParseException
- Specified by:
throwParseException
in interface Java.Locatable
compileError
public void compileError(java.lang.String message)
throws Java.CompileException
- Specified by:
compileError
in interface Java.Locatable
write
public void write(byte[] b)
writeByte
public void writeByte(int v)
writeInt
public void writeInt(int v)
writeShort
public void writeShort(int v)
writeOpcode
public void writeOpcode(int opcode)
writeBranch
public void writeBranch(int opcode,
ClassFile.CodeAttribute.Offset dst)
writeOffset
public void writeOffset(ClassFile.CodeAttribute.Offset src,
ClassFile.CodeAttribute.Offset dst)
writeConstantClassInfo
public void writeConstantClassInfo(java.lang.String descriptor)
writeConstantFieldrefInfo
public void writeConstantFieldrefInfo(java.lang.String classFD,
java.lang.String fieldName,
java.lang.String fieldFD)
writeConstantMethodrefInfo
public void writeConstantMethodrefInfo(java.lang.String classFD,
java.lang.String methodName,
java.lang.String methodMD)
writeConstantInterfaceMethodrefInfo
public void writeConstantInterfaceMethodrefInfo(java.lang.String classFD,
java.lang.String methodName,
java.lang.String methodMD)
writeConstantStringInfo
public void writeConstantStringInfo(java.lang.String value)
addConstantStringInfo
public short addConstantStringInfo(java.lang.String value)
writeConstantIntegerInfo
public void writeConstantIntegerInfo(int value)
addConstantIntegerInfo
public short addConstantIntegerInfo(int value)
writeConstantFloatInfo
public void writeConstantFloatInfo(float value)
addConstantFloatInfo
public short addConstantFloatInfo(float value)
writeConstantLongInfo
public void writeConstantLongInfo(long value)
writeConstantDoubleInfo
public void writeConstantDoubleInfo(double value)
newOffset
public ClassFile.CodeAttribute.Offset newOffset()
newUnsetOffset
public ClassFile.CodeAttribute.Offset newUnsetOffset()
newInserter
public ClassFile.CodeAttribute.Inserter newInserter()
pushInserter
public void pushInserter(ClassFile.CodeAttribute.Inserter ins)
popInserter
public void popInserter()
saveLocalVariables
public void saveLocalVariables()
restoreLocalVariables
public void restoreLocalVariables()
allocateLocalVariable
public short allocateLocalVariable(short size)