ClassFile(boolean isInterface, String classname, String superclass) Constructs a class file including no members.
Parameters: isInterface - true if this is an interface.
public ClassFile(boolean isInterface, String classname, String superclass)(Code)
Constructs a class file including no members.
Parameters: isInterface - true if this is an interface. false if this is a class. Parameters: classname - a fully-qualified class name Parameters: superclass - a fully-qualified super class name
Eliminates dead constant pool items. If a method or a field is removed,
the constant pool items used by that method/field become dead items. This
method recreates a constant pool.
Returns the attribute with the specified name. If there are multiple
attributes with that name, this method returns either of them. It
returns null if the specified attributed is not found.
Parameters: name - attribute name See Also:ClassFile.getAttributes()
Returns all the attributes. The returned List object
is shared with this object. If you add a new attribute to the list,
the attribute is also added to the classs file represented by this
object. If you remove an attribute from the list, it is also removed
from the class file.
a list of AttributeInfo objects. See Also:AttributeInfo
Returns the method with the specified name. If there are multiple methods
with that name, this method returns one of them.
null if no such a method is found.
Discards all attributes, associated with both the class file and the
members such as a code attribute and exceptions attribute. The unused
constant pool entries are also discarded (a new packed constant pool is
constructed).
Replaces all occurrences of a class name in the class file.
If class X is substituted for class Y in the class file, X and Y must
have the same signature. If Y provides a method m(), X must provide it
even if X inherits m() from the super class. If this fact is not
guaranteed, the bytecode verifier may cause an error.
Parameters: oldname - the replaced class name Parameters: newname - the substituted class name
renameClass
final public void renameClass(Map classnames)(Code)
Replaces all occurrences of several class names in the class file.
Parameters: classnames - specifies which class name is replaced with which new name.Class names must be described with the JVM-internalrepresentation like java/lang/Object. See Also:ClassFile.renameClass(String,String)