-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8355522: Remove the java.locale.useOldISOCodes system property
#26419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
85d8adf
bcfd8a7
93f3a8b
c68a63b
c3045b5
965830a
c427e18
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,6 @@ | |
|
|
||
| import jdk.internal.misc.CDS; | ||
| import jdk.internal.util.ReferencedKeySet; | ||
| import jdk.internal.util.StaticProperty; | ||
| import jdk.internal.vm.annotation.Stable; | ||
|
|
||
| import java.util.StringJoiner; | ||
|
|
@@ -110,16 +109,14 @@ public ReferencedKeySet<BaseLocale> get() { | |
| private @Stable int hash; | ||
|
|
||
| /** | ||
| * Boolean for the old ISO language code compatibility. | ||
| * The system property "java.locale.useOldISOCodes" is not security sensitive, | ||
| * so no need to ensure privileged access here. | ||
| * Emit the warning message if the system property "java.locale.useOldISOCodes" is | ||
| * specified. | ||
| */ | ||
| private static final boolean OLD_ISO_CODES = StaticProperty.javaLocaleUseOldISOCodes() | ||
| .equalsIgnoreCase("true"); | ||
| static { | ||
| if (OLD_ISO_CODES) { | ||
| System.err.println("WARNING: The use of the system property \"java.locale.useOldISOCodes\"" + | ||
| " is deprecated. It will be removed in a future release of the JDK."); | ||
| if (!System.getProperty("java.locale.useOldISOCodes", "").isEmpty()) { | ||
naotoj marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| System.err.println("WARNING: The system property" + | ||
| " \"java.locale.useOldISOCodes\" is no longer supported." + | ||
| " Any specified value will be ignored."); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -183,9 +180,9 @@ public static BaseLocale getInstance(String language, String script, | |
|
|
||
| public static String convertOldISOCodes(String language) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was there before this change, but above on line 166 I think we should update the outdated comment,
|
||
| return switch (language) { | ||
| case "he", "iw" -> OLD_ISO_CODES ? "iw" : "he"; | ||
| case "id", "in" -> OLD_ISO_CODES ? "in" : "id"; | ||
| case "yi", "ji" -> OLD_ISO_CODES ? "ji" : "yi"; | ||
| case "iw" -> "he"; | ||
| case "in" -> "id"; | ||
| case "ji" -> "yi"; | ||
| default -> language; | ||
| }; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. | ||
| * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. | ||
| * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| * | ||
| * This code is free software; you can redistribute it and/or modify it | ||
|
|
@@ -26,7 +26,7 @@ | |
| * 4118587 4118595 4122371 4126371 4126880 4135316 4135752 4139504 4139940 4143951 | ||
| * 4147315 4147317 4147552 4335196 4778440 4940539 5010672 6475525 6544471 6627549 | ||
| * 6786276 7066203 7085757 8008577 8030696 8170840 8174269 8255086 8263202 8287868 | ||
| * 8337603 | ||
| * 8337603 8355522 | ||
| * @summary test Locales | ||
| * @modules jdk.localedata | ||
| * @run junit LocaleTest | ||
|
|
@@ -709,34 +709,18 @@ public void TestChangedISO639Codes() { | |
| Locale indonesianOld = Locale.of("in"); | ||
| Locale indonesianNew = Locale.of("id"); | ||
|
|
||
| if ("true".equalsIgnoreCase(System.getProperty("java.locale.useOldISOCodes"))) { | ||
| if (!hebrewNew.getLanguage().equals("iw")) { | ||
| fail("Got back wrong language code for new Hebrew: expected \"iw\", got \"" | ||
| + hebrewNew.getLanguage() + "\""); | ||
| } | ||
| if (!yiddishNew.getLanguage().equals("ji")) { | ||
| fail("Got back wrong language code for new Yiddish: expected \"ji\", got \"" | ||
| + yiddishNew.getLanguage() + "\""); | ||
| } | ||
| if (!indonesianNew.getLanguage().equals("in")) { | ||
| fail("Got back wrong language code for new Indonesian: expected \"in\", got \"" | ||
| + indonesianNew.getLanguage() + "\""); | ||
| } | ||
| } else { | ||
| if (!hebrewOld.getLanguage().equals("he")) { | ||
| fail("Got back wrong language code for old Hebrew: expected \"he\", got \"" | ||
| + hebrewNew.getLanguage() + "\""); | ||
| } | ||
| if (!yiddishOld.getLanguage().equals("yi")) { | ||
| fail("Got back wrong language code for old Yiddish: expected \"yi\", got \"" | ||
| + yiddishNew.getLanguage() + "\""); | ||
| } | ||
| if (!indonesianOld.getLanguage().equals("id")) { | ||
| fail("Got back wrong language code for old Indonesian: expected \"id\", got \"" | ||
| + indonesianNew.getLanguage() + "\""); | ||
| } | ||
| if (!hebrewOld.getLanguage().equals("he")) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we are using JUnit, these assertions would be cleaner as
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this test file, there are other locations that use |
||
| fail("Got back wrong language code for old Hebrew: expected \"he\", got \"" | ||
| + hebrewNew.getLanguage() + "\""); | ||
|
||
| } | ||
| if (!yiddishOld.getLanguage().equals("yi")) { | ||
| fail("Got back wrong language code for old Yiddish: expected \"yi\", got \"" | ||
| + yiddishNew.getLanguage() + "\""); | ||
| } | ||
| if (!indonesianOld.getLanguage().equals("id")) { | ||
| fail("Got back wrong language code for old Indonesian: expected \"id\", got \"" | ||
| + indonesianNew.getLanguage() + "\""); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This history was relevant when the property existed. Since this is no longer the case, and we're quite a few releases away from 17, can we also remove this wording as well. Users on 26 should only be concerned with the "old" to "modern" mapping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Modified the unnecesarry history.