String testClasses = System.getProperty("test.classes"); for (int i = 10; i < 40; i++)
test("-XDtab:" + i, "-v", "-classpath", testClasses, "WhitespaceTest$HelloWorld");
void test(String... args) throws Exception { // need to avoid "//" appearing as a constant in the constant pool
String slash = "/";
String doubleSlash = slash + slash;
System.out.println("test: " + Arrays.asList(args));
String out = javap(args); for (String line: out.split("[\r\n]+")) { if (line.endsWith(" "))
error("line has trailing whitespace: " + line); int comment = line.indexOf(doubleSlash); if (comment > 0 && line.charAt(comment - 1) != ' ') { // make allowance for URLs if (!line.matches(".*\\bfile:/{3}.*"))
error("no space before comment: " + line);
} if (line.matches(" +}"))
error("bad indentation: " + line);
}
}
String javap(String... args) throws Exception {
StringWriter sw = new StringWriter();
PrintWriter out = new PrintWriter(sw); int rc = com.sun.tools.javap.Main.run(args, out);
out.close();
System.out.println(sw.toString()); if (rc < 0) thrownew Exception("javap exited, rc=" + rc); return sw.toString();
}
// small class to test repeatedly with different tab values staticclass HelloWorld { publicstaticvoid main(String... args) {
System.out.println("Hello World!");
}
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.8 Sekunden
(vorverarbeitet am 2026-10-11)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.