#!/usr/bin/env --split-string=${JDK_HOME}/bin/java @Makeshift/java_arguments @Makeshift/java_javac_arguments import static java.lang.System.out; import static Java.StringBuilding.clear; import static Java.StringBuilding.collapseWhitespace; /** A scratch shell command for smoke testing the library code. */ public final class SmokeTestCommand { // [AFN] private SmokeTestCommand() {} public static void main( final String[] arguments ) { final StringBuilder b = new StringBuilder(); out.println( " ——— empty='" + collapseWhitespace(clear(b).append("")) + "'" ); out.println( " ——— empty='" + collapseWhitespace(clear(b).append(" ")) + "'" ); out.println( " ——— empty='" + collapseWhitespace(clear(b).append(" ")) + "'" ); out.println( " ——— collapsed 1='" + collapseWhitespace(clear(b).append(" test ")) + "'" ); out.println( " ——— collapsed 2='" + collapseWhitespace(clear(b).append("test test")) + "'" ); out.println( " ——— collapsed 2='" + collapseWhitespace(clear(b).append(" test test ")) + "'" ); out.println( " ——— collapsed 2='" + collapseWhitespace(clear(b).append(" test test ")) + "'" ); out.println( " ——— collapsed 2='" + collapseWhitespace(clear(b).append(" test test ")) + "'" ); ; } private final StringBuilder stringBuilder = new StringBuilder(); } // NOTE // ──── // AFN Atypical file naming is allowed here. ‘The compiler does not enforce the optional restriction // defined at the end of JLS §7.6, that a type in a named package should exist in a file whose // name is composed from the type name followed by the .java extension.’ // // // // No longer, however, does this allowance extend to the package name. While in JDK releases // prior to 22 “the launcher's source-file mode was permissive about which package, if any, // was declared”, current releases enforce a correspondence between the declared package name // and the file path. Failing this, the launcher aborts with “end of path to source file // does not match its package name”.