|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object classUtils.javassist.compiler.Javac
public class Javac
Nested Class Summary | |
---|---|
static class |
Javac.CtFieldWithInit
|
Field Summary | |
---|---|
static java.lang.String |
param0Name
|
static java.lang.String |
proceedName
|
static java.lang.String |
resultVarName
|
Constructor Summary | |
---|---|
Javac(Bytecode b,
CompileTimeClass thisClass)
Constructs a compiler. |
|
Javac(CompileTimeClass thisClass)
Constructs a compiler. |
Method Summary | |
---|---|
CtMember |
compile(java.lang.String src)
Compiles a method, constructor, or field declaration to a class. |
Bytecode |
compileBody(CtBehavior method,
java.lang.String src)
Compiles a method (or constructor) body. |
void |
compileExpr(ASTree e)
Compiles an exression. |
void |
compileExpr(java.lang.String src)
Compiles an exression. |
void |
compileStmnt(java.lang.String src)
Compiles a statement (or a block). |
Bytecode |
getBytecode()
Returns the produced bytecode. |
void |
recordParams(CompileTimeClass[] params,
boolean isStatic)
Makes variables $0 (this), $1, $2, ..., and $args represent method parameters. |
void |
recordParams(java.lang.String target,
CompileTimeClass[] params,
boolean use0,
int varNo,
boolean isStatic)
Makes variables $0, $1, $2, ..., and $args represent method parameters. |
void |
recordProceed(ProceedHandler h)
Prepares to use $proceed(). |
void |
recordProceed(java.lang.String target,
java.lang.String method)
Prepares to use $proceed(). |
int |
recordReturnType(CompileTimeClass type,
boolean useResultVar)
Prepares to use cast $r, $w, $_, and $type. |
void |
recordType(CompileTimeClass t)
Prepares to use $type. |
int |
recordVariable(CompileTimeClass type,
java.lang.String name)
Makes the given variable available. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String param0Name
public static final java.lang.String resultVarName
public static final java.lang.String proceedName
Constructor Detail |
---|
public Javac(CompileTimeClass thisClass)
thisClass
- the class that a compiled method/field
belongs to.public Javac(Bytecode b, CompileTimeClass thisClass)
Bytecode
object
specified by b
.
thisClass
- the class that a compiled method/field
belongs to.Method Detail |
---|
public Bytecode getBytecode()
public CtMember compile(java.lang.String src) throws CompileError
In a method or constructor body, $0, $1, ... and $_ are not available.
CtMethod
, CtConstructor
,
or CtField
object.
CompileError
recordProceed(String,String)
public Bytecode compileBody(CtBehavior method, java.lang.String src) throws CompileError
CompileError
public void recordParams(CompileTimeClass[] params, boolean isStatic) throws CompileError
This must be called before calling compileStmnt()
and
compileExpr()
. The correct value of
isStatic
must be recorded before compilation.
CompileError
public void recordParams(java.lang.String target, CompileTimeClass[] params, boolean use0, int varNo, boolean isStatic) throws CompileError
This must be called before calling compileStmnt()
and
compileExpr()
. The correct value of
isStatic
must be recorded before compilation.
true if $0 is used.
varNo
- the register number of $0 (use0 is true)
or $1 (otherwise).target
- the type of $0 (it can be null if use0 is false).isStatic
- true if the method in which the compiled bytecode
is embedded is static.
CompileError
public int recordReturnType(CompileTimeClass type, boolean useResultVar) throws CompileError
If the return type is void, ($r) does nothing. The type of $_ is java.lang.Object.
useResultVar
- true if $_ is used.
CompileError
public void recordType(CompileTimeClass t)
public int recordVariable(CompileTimeClass type, java.lang.String name) throws CompileError
type
- variable typename
- variable name
CompileError
public void recordProceed(java.lang.String target, java.lang.String method) throws CompileError
target
- an expression specifying the target object.
if null, "this" is the target.method
- the method name.
CompileError
public void recordProceed(ProceedHandler h)
public void compileStmnt(java.lang.String src) throws CompileError
recordParams()
must be called before invoking
this method.
Local variables that are not declared in the compiled source text are not accessible within that source text. Fields and method parameters ($0, $1, ..) are available.
CompileError
public void compileExpr(java.lang.String src) throws CompileError
recordParams()
must be
called before invoking this method.
Local variables are not accessible
within the compiled source text. Fields and method parameters
($0, $1, ..) are available if recordParams()
have been invoked.
CompileError
public void compileExpr(ASTree e) throws CompileError
recordParams()
must be
called before invoking this method.
Local variables are not accessible
within the compiled source text. Fields and method parameters
($0, $1, ..) are available if recordParams()
have been invoked.
CompileError
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |