RFR: JDK-8275406: Add copy-to-clipboard feature to snippet UI [v2]

Pavel Rappo prappo at openjdk.java.net
Wed Oct 20 14:33:11 UTC 2021


On Wed, 20 Oct 2021 10:15:39 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:

>> test/langtools/jdk/javadoc/doclet/testSnippetTag/TestSnippetTag.java line 214:
>> 
>>> 212:                         <span class="element-name">case%s</span>()</div>
>>> 213:                         <div class="block">
>>> 214:                         <div class="snippet-container"><a href="#" class="snippet-copy" onclick="cop\
>> 
>> I'm sorry for hard-coding the snippet HTML output; I should've encapsulated it instead. Now every change to the HTML structure ripples through the tests. I'll work on improving that, I promise.
>> 
>> Separately. Aren't these "Copy" and "Copied!" strings localized? What happens if this test is run on some other locale?
>
> Yes, they are localized. Good question, I do believe tests are run with fixed en/US locale, but I'm not absolutely sure.

I've traced the execution of a local jtreg run with a debugger and examined the respective `jtr` file. Here is what I saw. The locale that the javadoc under test uses is that of returned by java.util.Locale.getDefault(). This happens because neither of the three pieces -- jtreg, JavadocTester, or TestSnippetTag -- passes `-locale` to javadoc.

Now I begin to wonder: how come we don't see failures on CI builds? Are we lucky and all the machines on which javadoc tests run use variants of English locale? Do we not have other tests where we hard-code English string variants? Is there something that I don't see?

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

PR: https://git.openjdk.java.net/jdk/pull/6011



More information about the build-dev mailing list