Remove globally affecting call to Locale#setDefault #5141
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Greetings!
The call to
Locale#setDefault
withinLocaleLoader#initialize
threw me for quite the massive loop today, as it affected multiple other plugins which assumedLocale#getDefault
to be the JVM's, and thus the system's locale, which mcMMO hard-coded toen_US
.While I have to admit that those other developers don't quite adhere to best practises by depending on this global state either, I still wholeheartedly believe that mcMMO should refrain from altering JVM-global-state nonetheless.
Also, since this initialization may occur after executing some of the
static
-blocks of other classes containing various formatters, many test-cases failed to execute due to formatting-discrepancies on my local machine, having had a non-english locale configured.My proposal represents merely a quick patch, as to cut out altering global state, but the ideal solution would obviously be to use the locale as configured on the plugin; that would demand a few architectural changes, which I do not quite have the resources for, at this point in time.
I hope that this tiny but still rather significant issue can be settled soon.
Best Regards,
BlvckBytes