gnu.jel
Class ClassFile
java.lang.Object
|
+--gnu.jel.ClassFile
- All Implemented Interfaces:
- java.lang.Cloneable
- public class ClassFile
- extends java.lang.Object
- implements java.lang.Cloneable
This class represents a classfile image in JEL.
Constructor Summary |
ClassFile(int modifiers,
java.lang.String name,
java.lang.Class superClass,
java.lang.Class[] interfaces,
LocalField[] fields)
Starts creation of a new class file. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
textData
protected gnu.jel.PatchableByteArrayOutputStream textData
currMethod
protected LocalMethod currMethod
typesStk
protected TypesStack typesStk
currJump
protected int currJump
invert_next_jump
protected boolean invert_next_jump
specialClasses
public static final java.lang.Class[] specialClasses
specialMethods
public static final java.lang.reflect.Member[] specialMethods
ClassFile
public ClassFile(int modifiers,
java.lang.String name,
java.lang.Class superClass,
java.lang.Class[] interfaces,
LocalField[] fields)
- Starts creation of a new class file.
Sizes of fAccess, fNames and fTypes
arrays must be the same.
- Parameters:
modifiers
- sum of one or more of PUBLIC, FINAL,
INTERFACE, ABSTRACT
constants of java.lang.reflect.Modifiername
- is the name of new class (must be in Java historical form,
i.e. with dots replaced by slashes '/')superClass
- is the superclass of this classinterfaces
- array of interfaces this class implementsfAccess
- array of modifiers for each field, each modifier can be a
sum of one or more of PUBLIC, PRIVATE,
PROTECTED, STATIC, FINAL,
VOLATILE, TRANSIENT constants defined in
java.lang.reflect.ModifierfNames
- array of names of all fields.fTypes
- array of Classes representing types of all fields.
clone
public java.lang.Object clone()
- Makes a clone of this object.
- Overrides:
clone
in class java.lang.Object
- Returns:
- a clone of this object
newMethod
public void newMethod(LocalMethod m,
java.lang.Class[] vars)
- Starts a new method of this class.
- Parameters:
m
- method descriptor.vars
- types of local variables..
getImage
public byte[] getImage()
labels_block
protected void labels_block()
labels_unblock
protected void labels_unblock()
labels_unblock_not
protected void labels_unblock_not()
ensure_jump
protected final void ensure_jump()
ensure_value
protected final void ensure_value()
branch_true
public void branch_true()
- Starts generation of code when condition is "true".
branch_false
public void branch_false()
- Starts generation of code when condition is "true".
branch_end
public void branch_end()
- Finishes generation of code for conditional.
- See Also:
branch_true()
logical_param
protected void logical_param(boolean and)
logical_end
protected void logical_end(boolean and)
codeB
public final void codeB(long op)
codeM
public final void codeM(java.lang.reflect.Member m)
code
public final void code(long op)
codeLDC
public final void codeLDC(java.lang.Object o,
int primitiveID)
codeI
public final void codeI(int ind)
getIndex
public int getIndex(java.lang.Object item,
int typeid)
- Used to determine an old CP index or to create a new one for an item.
- Parameters:
item
- an item to create or get an index fortypeid
- identifies type of argument to avoid linear searches- Returns:
- index for an item (negative if it has to be written)