public static void main(String[] args) throws Exception { Log._dontDie = true; // Ignore fatal class load error ArrayList<String> list = new ArrayList<String>(); for (String name : Boot.getClasses()) { if (!name.equals("water.api.RequestServer") && !name.equals("water.External") && !name.startsWith("water.r.")) { Class c = Class.forName(name); if (Freezable.class.isAssignableFrom(c)) list.add(c.getName()); } } Collections.sort(list); String s = "" + // "package water;\n" + // "\n" + // "// Do not edit - generated\n" + // "public class TypeMapGen {\n" + // " static final String[] CLAZZES = {\n" + // " \" BAD\", // 0: BAD\n" + // " \"[B\", // 1: Array of Bytes\n"; for (String c : list) s += " \"" + c + "\",\n"; s += " };\n"; s += "}"; Utils.writeFile(new File("src/main/java/water/TypeMapGen.java"), s); Log.info("Generated TypeMap"); }
static List<Class> all() { List<String> names = Boot.getClasses(); names.remove("water.Boot"); // In case called from Boot loader names.remove("water.Weaver"); Collections.sort(names); // For deterministic runs List<Class> tests = new ArrayList<Class>(); Log._dontDie = true; for( String name : names ) { try { Class c = Class.forName(name); if( isTest(c) ) tests.add(c); } catch( Throwable _ ) { } } if( tests.size() == 0 ) throw new RuntimeException("Failed to find tests"); filter(tests); return tests; }