Skip to content

Commit daa004a

Browse files
committed
Remove deprecated native config language and country options
1 parent 2fa5516 commit daa004a

File tree

7 files changed

+8
-85
lines changed

7 files changed

+8
-85
lines changed

core/deployment/src/main/java/io/quarkus/deployment/pkg/NativeConfig.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -71,30 +71,6 @@ public interface NativeConfig {
7171
@WithDefault("true")
7272
boolean headless();
7373

74-
/**
75-
* Defines the user language used for building the native executable.
76-
* With GraalVM versions prior to GraalVM for JDK 24 it also serves as the default Locale language for the native executable
77-
* application runtime.
78-
* e.g. en or cs as defined by IETF BCP 47 language tags.
79-
* <p>
80-
*
81-
* @deprecated Use the global quarkus.default-locale.
82-
*/
83-
@Deprecated
84-
Optional<@WithConverter(TrimmedStringConverter.class) String> userLanguage();
85-
86-
/**
87-
* Defines the user country used for building the native executable.
88-
* With GraalVM versions prior to GraalVM for JDK 24 it also serves as the default Locale country for the native executable
89-
* application runtime.
90-
* e.g. US or FR as defined by ISO 3166-1 alpha-2 codes.
91-
* <p>
92-
*
93-
* @deprecated Use the global quarkus.default-locale.
94-
*/
95-
@Deprecated
96-
Optional<@WithConverter(TrimmedStringConverter.class) String> userCountry();
97-
9874
/**
9975
* Defines the file encoding as in {@code -Dfile.encoding=...}.
10076
* <p>

core/deployment/src/main/java/io/quarkus/deployment/steps/LocaleProcessor.java

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@
2828
public class LocaleProcessor {
2929

3030
private static final Logger log = Logger.getLogger(LocaleProcessor.class);
31-
public static final String DEPRECATED_USER_LANGUAGE_WARNING = "Your application is setting the deprecated 'quarkus.native.user-language' configuration property. "
32-
+
33-
"Please, consider using only 'quarkus.default-locale' configuration property instead.";
34-
public static final String DEPRECATED_USER_COUNTRY_WARNING = "Your application is setting the deprecated 'quarkus.native.user-country' configuration property. "
35-
+
36-
"Please, consider using only 'quarkus.default-locale' configuration property instead.";
3731

3832
@BuildStep(onlyIf = { NativeBuild.class, NonDefaultLocale.class })
3933
void nativeResources(BuildProducer<NativeImageResourceBundleBuildItem> resources) {
@@ -92,14 +86,8 @@ public NonDefaultLocale(NativeConfig nativeConfig, LocalesBuildTimeConfig locale
9286

9387
@Override
9488
public boolean getAsBoolean() {
95-
return (nativeConfig.userLanguage().isPresent()
96-
&& !Locale.getDefault().getLanguage().equals(nativeConfig.userLanguage().get()))
97-
||
98-
(nativeConfig.userCountry().isPresent()
99-
&& !Locale.getDefault().getCountry().equals(nativeConfig.userCountry().get()))
100-
||
101-
(localesBuildTimeConfig.defaultLocale().isPresent() &&
102-
!Locale.getDefault().equals(localesBuildTimeConfig.defaultLocale().get()))
89+
return (localesBuildTimeConfig.defaultLocale().isPresent() &&
90+
!Locale.getDefault().equals(localesBuildTimeConfig.defaultLocale().get()))
10391
||
10492
localesBuildTimeConfig.locales().stream().anyMatch(l -> !Locale.getDefault().equals(l));
10593
}
@@ -110,8 +98,7 @@ public boolean getAsBoolean() {
11098
*
11199
* @param nativeConfig
112100
* @param localesBuildTimeConfig
113-
* @return User language set by 'quarkus.default-locale' or by deprecated 'quarkus.native.user-language' or
114-
* effectively LocalesBuildTimeConfig.DEFAULT_LANGUAGE if none of the aforementioned is set.
101+
* @return User language set by 'quarkus.default-locale' or effectively LocalesBuildTimeConfig.DEFAULT_LANGUAGE if not set.
115102
* @Deprecated
116103
*/
117104
@Deprecated
@@ -120,11 +107,6 @@ public static String nativeImageUserLanguage(NativeConfig nativeConfig, LocalesB
120107
if (localesBuildTimeConfig.defaultLocale().isPresent()) {
121108
language = localesBuildTimeConfig.defaultLocale().get().getLanguage();
122109
}
123-
if (nativeConfig.userLanguage().isPresent()) {
124-
log.warn(DEPRECATED_USER_LANGUAGE_WARNING);
125-
// The deprecated option takes precedence for users who are already using it.
126-
language = nativeConfig.userLanguage().get();
127-
}
128110
return language;
129111
}
130112

@@ -133,9 +115,7 @@ public static String nativeImageUserLanguage(NativeConfig nativeConfig, LocalesB
133115
*
134116
* @param nativeConfig
135117
* @param localesBuildTimeConfig
136-
* @return User country set by 'quarkus.default-locale' or by deprecated 'quarkus.native.user-country' or
137-
* effectively LocalesBuildTimeConfig.DEFAULT_COUNTRY (could be an empty string) if none of the aforementioned is
138-
* set.
118+
* @return User country set by 'quarkus.default-locale' or effectively LocalesBuildTimeConfig.DEFAULT_COUNTRY if not set.
139119
* @Deprecated
140120
*/
141121
@Deprecated
@@ -144,11 +124,6 @@ public static String nativeImageUserCountry(NativeConfig nativeConfig, LocalesBu
144124
if (localesBuildTimeConfig.defaultLocale().isPresent()) {
145125
country = localesBuildTimeConfig.defaultLocale().get().getCountry();
146126
}
147-
if (nativeConfig.userCountry().isPresent()) {
148-
log.warn(DEPRECATED_USER_COUNTRY_WARNING);
149-
// The deprecated option takes precedence for users who are already using it.
150-
country = nativeConfig.userCountry().get();
151-
}
152127
return country;
153128
}
154129

@@ -170,12 +145,7 @@ public static String nativeImageIncludeLocales(NativeConfig nativeConfig, Locale
170145

171146
// GraalVM for JDK 24 doesn't include the default locale used at build time. We must explicitly include the
172147
// specified locales - including the build-time locale if set by the user.
173-
// Note the deprecated options still count and take precedence.
174-
if (nativeConfig.userCountry().isPresent() && nativeConfig.userLanguage().isPresent()) {
175-
additionalLocales.add(new Locale(nativeConfig.userLanguage().get(), nativeConfig.userCountry().get()));
176-
} else if (nativeConfig.userLanguage().isPresent()) {
177-
additionalLocales.add(new Locale(nativeConfig.userLanguage().get()));
178-
} else if (localesBuildTimeConfig.defaultLocale().isPresent()) {
148+
if (localesBuildTimeConfig.defaultLocale().isPresent()) {
179149
additionalLocales.add(localesBuildTimeConfig.defaultLocale().get());
180150
}
181151

core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,7 @@ public void write(String s, byte[] bytes) {
9595
overallCatch.marshalAsArray(String.class, overallCatch.load(""))); // empty string means initialize everything
9696

9797
// Set the user.language and user.country system properties to the default locale
98-
// The deprecated option takes precedence for users who are already using it.
99-
if (nativeConfig.userLanguage().isPresent()) {
100-
overallCatch.invokeStaticMethod(REGISTER_RUNTIME_SYSTEM_PROPERTIES,
101-
overallCatch.load("user.language"), overallCatch.load(nativeConfig.userLanguage().get()));
102-
if (nativeConfig.userCountry().isPresent()) {
103-
overallCatch.invokeStaticMethod(REGISTER_RUNTIME_SYSTEM_PROPERTIES,
104-
overallCatch.load("user.country"), overallCatch.load(nativeConfig.userCountry().get()));
105-
}
106-
} else if (localesBuildTimeConfig.defaultLocale().isPresent()) {
98+
if (localesBuildTimeConfig.defaultLocale().isPresent()) {
10799
overallCatch.invokeStaticMethod(REGISTER_RUNTIME_SYSTEM_PROPERTIES,
108100
overallCatch.load("user.language"),
109101
overallCatch.load(localesBuildTimeConfig.defaultLocale().get().getLanguage()));

core/deployment/src/test/java/io/quarkus/deployment/pkg/TestNativeConfig.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,6 @@ public boolean headless() {
5555
return false;
5656
}
5757

58-
@Override
59-
public Optional<String> userLanguage() {
60-
return Optional.empty();
61-
}
62-
63-
@Override
64-
public Optional<String> userCountry() {
65-
return Optional.empty();
66-
}
67-
6858
@Override
6959
public String fileEncoding() {
7060
return null;
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
quarkus.locales=de,fr-FR,ja,uk-UA
2-
# Note that quarkus.native.user-language is deprecated and solely quarkus.default-locale should be
3-
# used in your application properties. This test uses it only to verify compatibility.
42
quarkus.default-locale=mt-MT

integration-tests/locales/some/src/test/java/io/quarkus/locales/it/LocalesIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void testDefaultLocalePre24_2() {
9393
/*
9494
* Prior to GraalVM 24.2, the locale could not be changed at runtime.
9595
* "Švýcarsko" is the correct name for Switzerland in Czech language.
96-
* Czech is the default language as per quarkus.native.user-language=cs.
96+
* Czech is the default language as per quarkus.default-locale=cs.
9797
*/
9898
.body(is("Švýcarsko"))
9999
.log().all();
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
quarkus.locales=de,fr-FR,ja,uk-UA
2-
# Note that quarkus.native.user-language is deprecated and solely quarkus.default-locale should be
3-
# used in your application properties. This test uses it only to verify compatibility.
4-
quarkus.native.user-language=cs
5-
quarkus.default-locale=en-US
2+
quarkus.default-locale=cs-US
63
quarkus.test.arg-line=-Duser.language=de
74
quarkus.test.env.LC_ALL=mt_MT.UTF-8

0 commit comments

Comments
 (0)