Skip to content

Commit 0c58cce

Browse files
committed
Deprecate obsolete system property constants.
- org.apache.commons.lang3.SystemProperties.AWT_TOOLKIT - org.apache.commons.lang3.SystemProperties.JAVA_AWT_FONTS - org.apache.commons.lang3.SystemProperties.JAVA_AWT_GRAPHICSENV - org.apache.commons.lang3.SystemProperties.JAVA_AWT_HEADLESS - org.apache.commons.lang3.SystemProperties.JAVA_AWT_PRINTERJOB - org.apache.commons.lang3.SystemProperties.JAVA_COMPILER - org.apache.commons.lang3.SystemProperties.JAVA_ENDORSED_DIRS - org.apache.commons.lang3.SystemProperties.JAVA_EXT_DIRS Deprecate methods for obsolete system propery constant - org.apache.commons.lang3.SystemProperties.getAwtToolkit() - org.apache.commons.lang3.SystemProperties.getJavaAwtFonts() - org.apache.commons.lang3.SystemProperties.getJavaAwtGraphicsenv() - org.apache.commons.lang3.SystemProperties.getJavaAwtHeadless() - org.apache.commons.lang3.SystemProperties.getJavaAwtPrinterjob() - org.apache.commons.lang3.SystemProperties.getJavaCompiler() - org.apache.commons.lang3.SystemProperties.getJavaEndorsedDirs() - org.apache.commons.lang3.SystemProperties.getJavaExtDirs() - org.apache.commons.lang3.SystemUtils.isJavaAwtHeadless()
1 parent b8d9617 commit 0c58cce

File tree

3 files changed

+74
-2
lines changed

3 files changed

+74
-2
lines changed

src/changes/changes.xml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,23 @@ The <action> type attribute can be add,update,fix,remove.
6565
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate NumberUtils.compare(int, int) in favor of Integer.compare(int, int).</action>
6666
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate NumberUtils.compare(long, long) in favor of Long.compare(long, long).</action>
6767
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate NumberUtils.compare(short, short) in favor of Short.compare(short, short).</action>
68-
<!-- FIX Javadoc -->
68+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate obsolete system property constant SystemProperties.AWT_TOOLKIT.</action>
69+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate obsolete system property constant SystemProperties.JAVA_AWT_FONTS.</action>
70+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate obsolete system property constant SystemProperties.JAVA_AWT_GRAPHICSENV.</action>
71+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate obsolete system property constant SystemProperties.JAVA_AWT_HEADLESS.</action>
72+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate obsolete system property constant SystemProperties.JAVA_AWT_PRINTERJOB.</action>
73+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate obsolete system property constant SystemProperties.JAVA_COMPILER.</action>
74+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate obsolete system property constant SystemProperties.JAVA_ENDORSED_DIRS.</action>
75+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate obsolete system property constant SystemProperties.JAVA_EXT_DIRS.</action> <!-- FIX Javadoc -->
76+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate method for obsolete system property constant SystemProperties.getAwtToolkit()</action>
77+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate method for obsolete system property constant SystemProperties.getJavaAwtFonts()</action>
78+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate method for obsolete system property constant SystemProperties.getJavaAwtGraphicsenv()</action>
79+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate method for obsolete system property constant SystemProperties.getJavaAwtHeadless()</action>
80+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate method for obsolete system property constant SystemProperties.getJavaAwtPrinterjob()</action>
81+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate method for obsolete system property constant SystemProperties.getJavaCompiler()</action>
82+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate method for obsolete system property constant SystemProperties.getJavaEndorsedDirs()</action>
83+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate method for obsolete system property constant SystemProperties.getJavaExtDirs()</action>
84+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate method for obsolete system property constant SystemUtils.isJavaAwtHeadless()</action>
6985
<action type="fix" dev="ggregory" due-to="Gary Gregory">[javadoc] General improvements.</action>
7086
<action type="fix" dev="ggregory" due-to="Gary Gregory">[javadoc] Fix thrown exception documentation for MethodUtils.getMethodObject(Class&lt;?&gt;, String, Class&lt;?&gt;...).</action>
7187
<action type="fix" dev="ggregory" due-to="Scott Parish">[javadoc] Strings::equalsAny: CI doc string should show it's insensitive #1416.</action>

src/main/java/org/apache/commons/lang3/SystemProperties.java

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ public final class SystemProperties {
4747
* </p>
4848
*
4949
* @see <a href="https://docs.oracle.com/en/java/javase/25/docs/api/system-properties.html">System Properties</a>
50+
* @deprecated Deprecated without replacement.
5051
*/
52+
@Deprecated
5153
public static final String AWT_TOOLKIT = "awt.toolkit";
5254

5355
/**
@@ -239,7 +241,9 @@ public final class SystemProperties {
239241
* </p>
240242
*
241243
* @see <a href="https://docs.oracle.com/en/java/javase/25/docs/api/system-properties.html">java.awt.fonts</a>
244+
* @deprecated Deprecated without replacement.
242245
*/
246+
@Deprecated
243247
public static final String JAVA_AWT_FONTS = "java.awt.fonts";
244248

245249
/**
@@ -249,7 +253,9 @@ public final class SystemProperties {
249253
* </p>
250254
*
251255
* @see <a href="https://docs.oracle.com/en/java/javase/25/docs/api/system-properties.html">java.awt.graphicsenv</a>
256+
* @deprecated Deprecated without replacement.
252257
*/
258+
@Deprecated
253259
public static final String JAVA_AWT_GRAPHICSENV = "java.awt.graphicsenv";
254260

255261
/**
@@ -259,7 +265,9 @@ public final class SystemProperties {
259265
* </p>
260266
*
261267
* @see <a href="https://docs.oracle.com/en/java/javase/25/docs/api/system-properties.html">java.awt.headless</a>
268+
* @deprecated Deprecated without replacement.
262269
*/
270+
@Deprecated
263271
public static final String JAVA_AWT_HEADLESS = "java.awt.headless";
264272

265273
/**
@@ -269,11 +277,15 @@ public final class SystemProperties {
269277
* </p>
270278
*
271279
* @see <a href="https://docs.oracle.com/en/java/javase/25/docs/api/system-properties.html">java.awt.printerjob</a>
280+
* @deprecated Deprecated without replacement.
272281
*/
282+
@Deprecated
273283
public static final String JAVA_AWT_PRINTERJOB = "java.awt.printerjob";
274284

275285
/**
276286
* The System property name {@value}.
287+
*
288+
* @see <a href="https://docs.oracle.com/en/java/javase/25/docs/api/system-properties.html">java.class.path</a>
277289
*/
278290
public static final String JAVA_CLASS_PATH = "java.class.path";
279291

@@ -285,9 +297,14 @@ public final class SystemProperties {
285297
/**
286298
* The System property name {@value}.
287299
* <p>
288-
* Not in Java 21. Last seen in Java 17.
300+
* Not in Java 17 and above (Javadoc).
289301
* </p>
302+
*
303+
* @see <a href="https://bugs.openjdk.org/browse/JDK-8305998">JDK-8305998</a>
304+
* @see <a href="https://docs.oracle.com/en/java/javase/25/docs/api/system-properties.html">System Properties</a>
305+
* @deprecated Deprecated without replacement.
290306
*/
307+
@Deprecated
291308
public static final String JAVA_COMPILER = "java.compiler";
292309

293310
/**
@@ -304,15 +321,21 @@ public final class SystemProperties {
304321
* <p>
305322
* Not in Java 17 and above (Javadoc).
306323
* </p>
324+
*
325+
* @deprecated Deprecated without replacement.
307326
*/
327+
@Deprecated
308328
public static final String JAVA_ENDORSED_DIRS = "java.endorsed.dirs";
309329

310330
/**
311331
* The System property name {@value}.
312332
* <p>
313333
* Not in Java 17 and above (Javadoc).
314334
* </p>
335+
*
336+
* @deprecated Deprecated without replacement.
315337
*/
338+
@Deprecated
316339
public static final String JAVA_EXT_DIRS = "java.ext.dirs";
317340

318341
/**
@@ -1546,7 +1569,11 @@ public static String getAppleAwtEnableTemplateImages() {
15461569
* </p>
15471570
*
15481571
* @return The system property value or {@code null} if the property is absent or a security problem occurs.
1572+
* @see <a href="https://docs.oracle.com/en/java/javase/25/docs/api/system-properties.html">System Properties</a>
1573+
* @see #AWT_TOOLKIT
1574+
* @deprecated Deprecated without replacement.
15491575
*/
1576+
@Deprecated
15501577
public static String getAwtToolkit() {
15511578
return getProperty(AWT_TOOLKIT);
15521579
}
@@ -1922,7 +1949,11 @@ public static int getInt(final String key, final IntSupplier defaultIfAbsent) {
19221949
* </p>
19231950
*
19241951
* @return The system property value or {@code null} if the property is absent or a security problem occurs.
1952+
* @see <a href="https://docs.oracle.com/en/java/javase/25/docs/api/system-properties.html">java.awt.fonts</a>
1953+
* @see #JAVA_AWT_FONTS
1954+
* @deprecated Deprecated without replacement.
19251955
*/
1956+
@Deprecated
19261957
public static String getJavaAwtFonts() {
19271958
return getProperty(JAVA_AWT_FONTS);
19281959
}
@@ -1934,7 +1965,9 @@ public static String getJavaAwtFonts() {
19341965
* </p>
19351966
*
19361967
* @return The system property value or {@code null} if the property is absent or a security problem occurs.
1968+
* @deprecated Deprecated without replacement.
19371969
*/
1970+
@Deprecated
19381971
public static String getJavaAwtGraphicsenv() {
19391972
return getProperty(JAVA_AWT_GRAPHICSENV);
19401973
}
@@ -1946,7 +1979,11 @@ public static String getJavaAwtGraphicsenv() {
19461979
* </p>
19471980
*
19481981
* @return The system property value or {@code null} if the property is absent or a security problem occurs.
1982+
* @see <a href="https://docs.oracle.com/en/java/javase/25/docs/api/system-properties.html">java.awt.graphicsenv</a>
1983+
* @see #JAVA_AWT_HEADLESS
1984+
* @deprecated Deprecated without replacement.
19491985
*/
1986+
@Deprecated
19501987
public static String getJavaAwtHeadless() {
19511988
return getProperty(JAVA_AWT_HEADLESS);
19521989
}
@@ -1958,7 +1995,11 @@ public static String getJavaAwtHeadless() {
19581995
* </p>
19591996
*
19601997
* @return The system property value or {@code null} if the property is absent or a security problem occurs.
1998+
* @see <a href="https://docs.oracle.com/en/java/javase/25/docs/api/system-properties.html">java.awt.printerjob</a>
1999+
* @see #JAVA_AWT_PRINTERJOB
2000+
* @deprecated Deprecated without replacement.
19612001
*/
2002+
@Deprecated
19622003
public static String getJavaAwtPrinterjob() {
19632004
return getProperty(JAVA_AWT_PRINTERJOB);
19642005
}
@@ -1970,6 +2011,8 @@ public static String getJavaAwtPrinterjob() {
19702011
* </p>
19712012
*
19722013
* @return The system property value or {@code null} if the property is absent or a security problem occurs.
2014+
* @see <a href="https://docs.oracle.com/en/java/javase/25/docs/api/system-properties.html">java.class.path</a>
2015+
* @see #JAVA_CLASS_PATH
19732016
*/
19742017
public static String getJavaClassPath() {
19752018
return getProperty(JAVA_CLASS_PATH);
@@ -1994,7 +2037,11 @@ public static String getJavaClassVersion() {
19942037
* </p>
19952038
*
19962039
* @return The system property value or {@code null} if the property is absent or a security problem occurs.
2040+
* @see <a href="https://bugs.openjdk.org/browse/JDK-8305998">JDK-8305998</a>
2041+
* @see <a href="https://docs.oracle.com/en/java/javase/25/docs/api/system-properties.html">System Properties</a>
2042+
* @deprecated Deprecated without replacement.
19972043
*/
2044+
@Deprecated
19982045
public static String getJavaCompiler() {
19992046
return getProperty(JAVA_COMPILER);
20002047
}
@@ -2019,7 +2066,10 @@ public static String getJavaContentHandlerPkgs() {
20192066
* </p>
20202067
*
20212068
* @return The system property value or {@code null} if the property is absent or a security problem occurs.
2069+
* @see <a href="https://docs.oracle.com/en/java/javase/25/docs/api/system-properties.html">System Properties</a>
2070+
* @deprecated Deprecated without replacement.
20222071
*/
2072+
@Deprecated
20232073
public static String getJavaEndorsedDirs() {
20242074
return getProperty(JAVA_ENDORSED_DIRS);
20252075
}
@@ -2031,7 +2081,11 @@ public static String getJavaEndorsedDirs() {
20312081
* </p>
20322082
*
20332083
* @return The system property value or {@code null} if the property is absent or a security problem occurs.
2084+
* @see <a href="https://docs.oracle.com/en/java/javase/25/docs/api/system-properties.html">System Properties</a>
2085+
* @see #JAVA_EXT_DIRS
2086+
* @deprecated Deprecated without replacement.
20342087
*/
2088+
@Deprecated
20352089
public static String getJavaExtDirs() {
20362090
return getProperty(JAVA_EXT_DIRS);
20372091
}

src/main/java/org/apache/commons/lang3/SystemUtils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2282,7 +2282,9 @@ public static String getUserName(final String defaultValue) {
22822282
* @see #JAVA_AWT_HEADLESS
22832283
* @since 2.1
22842284
* @since Java 1.4
2285+
* @deprecated Deprecated without replacement.
22852286
*/
2287+
@Deprecated
22862288
public static boolean isJavaAwtHeadless() {
22872289
return Boolean.TRUE.toString().equals(JAVA_AWT_HEADLESS);
22882290
}

0 commit comments

Comments
 (0)