Methods Summary |
---|
public java.lang.String | getClassName()Returns class name.
return class_name;
|
public com.sun.satsa.jcrmic.classfile.JClass[] | getInterfaces()Returns implemented interfaces.
return interfaces;
|
public JMethod[] | getMethods()Returns methods declared by class.
return methods;
|
public com.sun.satsa.jcrmic.classfile.JClass | getSuperClass()Returns super class.
return superClass;
|
public boolean | isInterface()Check if the class is interface.
return (access_flags & ACC_INTERFACE) != 0;
|
public boolean | isRemote()Returns 'remote' flag value.
return remote;
|
public boolean | isSubclass(com.sun.satsa.jcrmic.classfile.JClass c2)Verifies if the class is equal to or a sublass of specified class.
String name = c2.getClassName();
JClass c1 = this;
while (true) {
if (c1.getClassName().equals(name)) {
return true;
}
c1 = c1.getSuperClass();
if (c1 == null) {
return false;
}
}
|
public boolean | isVerified()Returns 'verifed' flag value.
return verified;
|
public void | parse(java.io.DataInputStream dis)Parse and resolve Java class.
dis.readInt(); // magic
dis.readUnsignedShort(); // minor_version
dis.readUnsignedShort(); // major_version
JConstantPool constant_pool =
new JConstantPool(dis.readUnsignedShort());
constant_pool.parse(dis);
access_flags = dis.readUnsignedShort();
int this_class_index = dis.readUnsignedShort();
int super_class_index = dis.readUnsignedShort();
int[] interface_indexes = new int[dis.readUnsignedShort()];
for (int i = 0; i < interface_indexes.length; i++) {
interface_indexes[i] = dis.readUnsignedShort();
}
int field_count = dis.readUnsignedShort();
for (int i = 0; i < field_count; i++) {
dis.readUnsignedShort(); // access_flags
dis.readUnsignedShort(); // name_index
dis.readUnsignedShort(); // descriptor_index
int attrib_count = dis.readUnsignedShort();
for (int k = 0; k < attrib_count; k++) {
int index = dis.readUnsignedShort();
JAttribute.create(constant_pool, index).parse(dis);
}
}
methods = new JMethod[dis.readUnsignedShort()];
for (int i = 0; i < methods.length; i++) {
methods[i] = new JMethod(constant_pool);
methods[i].parse(dis);
}
int attribute_count = dis.readUnsignedShort();
for (int i = 0; i < attribute_count; i++) {
int index = dis.readUnsignedShort();
JAttribute.create(constant_pool, index).parse(dis);
}
// resolve
class_name = constant_pool.getConstantClass(
this_class_index).getClassName();
if (super_class_index != 0) {
super_class_name = constant_pool.getConstantClass(
super_class_index).getClassName();
} else {
super_class_name = null;
}
interface_names = new String[interface_indexes.length];
for (int i = 0; i < interface_names.length; i++) {
interface_names[i] = constant_pool.getConstantClass(
interface_indexes[i]).getClassName();
}
|
public void | setRemote()Set 'remote' flag.
remote = true;
|
public void | setVerified()Set 'verified' flag.
verified = true;
|
public boolean | update()Load all related classes.
if (class_name.equals("java/rmi/Remote")) {
setRemote();
}
String name = super_class_name;
if (name != null) {
if (! classes.loadClass(name))
return false;
superClass = classes.getClass(name);
if (superClass.isRemote())
setRemote();
}
interfaces = new JClass[interface_names.length];
for (int i = 0; i < interface_names.length; i++) {
if (!classes.loadClass(interface_names[i]))
return false;
interfaces[i] = classes.getClass(interface_names[i]);
if (interfaces[i].isRemote())
setRemote();
}
JMethod[] methods = getMethods();
for (int i = 0; i < methods.length; i++) {
String[] exceptions = methods[i].getExceptionsThrown();
if (exceptions != null) {
for (int j = 0; j < exceptions.length; j++) {
if (!classes.loadClass(exceptions[j])) {
return false;
}
}
}
}
return true;
|