Map<String, Set<String>> runExamples(File examplesDir, boolean verbose) { Map<String, Set<String>> map = new TreeMap<String, Set<String>>(); for (Example e : getExamples(examplesDir)) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.run(pw, true, verbose); pw.close(); String[] lines = sw.toString().split("\n"); for (String line : lines) { if (!line.startsWith("compiler.")) continue; int colon = line.indexOf(":"); if (colon == -1) continue; String key = line.substring(0, colon); StringBuilder sb = new StringBuilder(); sb.append("# "); int i = 0; String[] descs = line.substring(colon + 1).split(", *"); for (String desc : descs) { if (i > 0) sb.append(", "); sb.append(i++); sb.append(": "); sb.append(desc.trim()); } Set<String> set = map.get(key); if (set == null) map.put(key, set = new TreeSet<String>()); set.add(sb.toString()); } } return map; }