import java.lang.reflect.*; import java.util.List; import java.util.ArrayList; import java.util.Iterator; class EncCheck { StringBuffer errorLog = new StringBuffer(); // Empty if no errors. Class clazz; // the class we are currently checking List nonStaticFields; // null, or a list of all non-static fields /* pre: clazz != null * post: correct initialization of nonStaticFields */ public void findAllNonStaticFields(){ Field[] fields = clazz.getDeclaredFields(); nonStaticFields = new ArrayList(); for (int i=0; i 0 ) System.out.println(errorLog.toString()); else System.out.println("No errors"); } public static void main(String[] args) throws Exception { String className = args[0]; Class c = Class.forName(className); EncCheck checker = new EncCheck(); checker.check(c); } }