[ 
https://issues.apache.org/jira/browse/CALCITE-6580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17881680#comment-17881680
 ] 

Julian Hyde commented on CALCITE-6580:
--------------------------------------

To address this, which I missed the first time:

{quote}
If we forbid the use from tests then we would need to launch locale specific 
tests with different system properties (i.e., user.language) or environment 
variable which is more cumbersome.
{quote}

Since tests run in parallel, calling {{Locale.setDefault}} is not a good way to 
achieve this. It is possible that the test setting locale to French overlaps 
one setting locale to German, and that will manifest as a flaky test.

In my opinion, the best way to test in multiple locales is a CI run with 
{{-Duser.country=CA -Duser.language=fr}} or the Gradle equivalent.

> Remove Locale.setDefault
> ------------------------
>
>                 Key: CALCITE-6580
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6580
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Julian Hyde
>            Priority: Major
>
> Remove all calls to {{Locale.setDefault}} in tests and production code.
> That function does not operate on the current thread; it affects all threads 
> in the JVM. As such, it may affect other tests running at the same time, and 
> affect other statements running at the same time.
> I hope, and believe, that the production code does not depend on 
> {{Locale.getDefault}}. But let's make sure by removing {{setDefault}} from 
> all tests.
> Add {{Locale.setDefault}} to 
> [forbidden-apis|https://github.com/apache/calcite/blob/main/src/main/config/forbidden-apis/signatures.txt].



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to