
jas.FieldCP Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jasmin Show documentation
Show all versions of jasmin Show documentation
Java Assembler Interface for the Soot framework
/**
* FieldCP's are used to refer to a field in a particular
* class.
*
* @author $Author: fqian $
* @version $Revision: 1.1 $
*/
package jas;
import java.io.*;
public class FieldCP extends CP implements RuntimeConstants
{
ClassCP clazz;
NameTypeCP nt;
/**
* FieldCP's are created by specifying the class to which the
* field belongs, the name of the symbol, and its signature.
* For instance, to refer to the field out in
* System.out use
* new FieldCP("java/lang/System", "out", "Ljava/io/PrintStream;")
*
* @param clazz Name of class
* @param name Name of symbol
* @param sig Signature for symbol
*/
public FieldCP(String clazz, String name, String sig)
{
uniq = (clazz + "&%$#&" + name + "*()#$" + sig).intern();
this.clazz = new ClassCP(clazz);
this.nt = new NameTypeCP(name, sig);
}
void resolve(ClassEnv e)
{
e.addCPItem(clazz);
e.addCPItem(nt);
}
void write(ClassEnv e, DataOutputStream out)
throws IOException, jasError
{
out.writeByte(CONSTANT_FIELD);
out.writeShort(e.getCPIndex(clazz));
out.writeShort(e.getCPIndex(nt));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy