On Fri, 20 Oct 2023 08:48:14 GMT, Hannes Wallnöfer <hann...@openjdk.org> wrote:

>> test/langtools/jdk/javadoc/doclet/testIndex/TestSelfIndexing.java line 153:
>> 
>>> 151:                                 "package-use.html", 
>>> "package-tree.html", "preview-list.html",
>>> 152:                                 "new-list.html", 
>>> "allclasses-index.html", "allpackages-index.html",
>>> 153:                                 "constant-values.html", 
>>> "system-properties.html", "serialized-form.html"
>> 
>> The hard-coded list of derived HTML files could become outdated when new 
>> lists are added. For example, we just recently added `restricted-list.html` 
>> for restricted methods. Could we detect this from the presence of a dash in 
>> the file name, as this is our way to avoid conflict of derived files with 
>> Java types?
>
> Upon second thought, feel free to ignore above comment. It's maybe not 
> required to catch all derived files, and the explicit list makes the code 
> much easier to understand.

While not every file with a hyphen in its name is derived, we might be able to 
future-proof and shorten this check by somewhat inverting it:

    .filter(r -> {
        String f = r.group("file");
        if (!f.contains("-"))
            return false;
        return switch (f) {
            case "package-summary.html",
                    "module-summary.html",
                    "overview-summary.html",
                    "help-doc.html" -> false;
            default -> {
                String p = r.group("path");
                yield !p.contains("/doc-files/") && !p.startsWith("doc-files/");
            }
        };
    })

@hns?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16271#discussion_r1366726355

Reply via email to