use of com.ibm.dtfj.java.JavaField in project openj9 by eclipse.
the class ClassOutput method printStaticFields.
public static void printStaticFields(JavaClass jc, PrintStream out) {
// if the class name refers to an array, return because there are no fields
try {
if (jc.isArray()) {
return;
}
} catch (CorruptDataException cde) {
out.print("\t <can't determine if class is array; assuming it's not>\n\n");
}
String className;
try {
className = jc.getName();
} catch (CorruptDataException cde) {
className = null;
}
// we've found a class, so we'll print out its static fields
boolean found = false;
Iterator itField = jc.getDeclaredFields();
while (itField.hasNext()) {
JavaField jf = (JavaField) itField.next();
boolean isStatic;
try {
isStatic = Modifier.isStatic(jf.getModifiers());
} catch (CorruptDataException e) {
out.print("\t <error while getting modifier for field \"");
try {
out.print(jf.getName());
} catch (CorruptDataException d) {
out.print(Exceptions.getCorruptDataExceptionString());
}
out.print("\", " + Exceptions.getCorruptDataExceptionString() + ">");
isStatic = false;
}
if (isStatic) {
if (!found) {
out.print("\t static fields for \"" + className + "\"\n");
}
found = true;
printStaticFieldData(jf, out);
}
}
if (found)
out.print("\n");
else
out.print("\t \"" + className + "\" has no static fields\n\n");
}
Aggregations