On Mon, 1 Jul 2024 15:19:22 GMT, Pavel Rappo <pra...@openjdk.org> wrote:
>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SnippetTaglet.java >> line 498: >> >>> 496: return null; >>> 497: } >>> 498: return (lastPeriod == fileName.length() - 1) ? null : >>> fileName.substring(lastPeriod + 1); >> >> Some files, like `.gitignore`, only has suffixes, yet they are valid >> languages. What do you think? > > Sure, that's why there's `<= 0` and not `< 0` one line above that: > > int lastPeriod = fileName.lastIndexOf('.'); > if (lastPeriod <= 0) { > return null; > > So, if `fileName` starts with `.`, the extension is null. I think Chen's point was that it should not be `null`, to which I agree, although it is probably a corner case. One thing I would consider is converting the result or this method to lower case, since that is how the language attribute value is usually represented. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19971#discussion_r1661285093