class CanonicalRootValidator {

    /**
     * Validates the specified setting, returning an error message if validation
     * fails.
     * @return a defined instance if not valid or {@code null} otherwise
     */
    public static String validate(String setting, String elementDescription) {<FILL_FUNCTION_BODY>}

    /** Private to enforce static. */
    private CanonicalRootValidator() {

    }
}

        // Test that the value ends with the system separator.
        if (!setting.endsWith(File.separator)) {
            return elementDescription + " must end with a separator";
        }
        // Test that the value is not like a Windows root (e.g. C:\ or Z:/).
        if (setting.matches("\\w:(?:[/\\\\]*)")) {
            return elementDescription + " cannot be a root directory";
        }
        // Test that some character other than separators is in the value.
        if (!setting.matches(".*[^/\\\\].*")) {
            return elementDescription + " cannot be the root directory";
        }

        /*
         * There is no need to validate that the caller has not specified e.g.
         * "/./" (i.e. an alias to the root "/") because --canonicalRoot values
         * are matched via string comparison against true canonical values got
         * via File.getCanonicalPath(). An alias like "/./" is therefore a
         * never-matching value and hence inactive.
         */
        return null;
    
<no_super_class>