You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "debbs061 (via GitHub)" <gi...@apache.org> on 2026/01/10 03:32:24 UTC
[PR] [LANG-1810] Deprecate SOFT_MAX_ARRAY_LENGTH in favor of MAX_ARRAY_LENGTH [commons-lang]
debbs061 opened a new pull request, #1559:
URL: https://github.com/apache/commons-lang/pull/1559
## Overview
Addresses **LANG-1810** by transitioning the non-final field `SOFT_MAX_ARRAY_LENGTH` to a final constant.
## Changes
- **Deprecation**: Marked `SOFT_MAX_ARRAY_LENGTH` as `@Deprecated`.
- **New Constant**: Added `public static final int MAX_ARRAY_LENGTH` as a safe alternative.
## Why
To resolve the "non-final public field" flaw while maintaining **Binary Compatibility (BC)** for the 3.x release line.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LANG-1810] Deprecate SOFT_MAX_ARRAY_LENGTH in favor of MAX_ARRAY_LENGTH [commons-lang]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #1559:
URL: https://github.com/apache/commons-lang/pull/1559#issuecomment-3734402410
@debbs061
I merged the PR. Thank you! 👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LANG-1810] Deprecate SOFT_MAX_ARRAY_LENGTH in favor of MAX_ARRAY_LENGTH [commons-lang]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #1559:
URL: https://github.com/apache/commons-lang/pull/1559#issuecomment-3733970370
JIra https://issues.apache.org/jira/browse/LANG-1810
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LANG-1810] Deprecate SOFT_MAX_ARRAY_LENGTH in favor of MAX_ARRAY_LENGTH [commons-lang]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory merged PR #1559:
URL: https://github.com/apache/commons-lang/pull/1559
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [LANG-1810] Deprecate SOFT_MAX_ARRAY_LENGTH in favor of MAX_ARRAY_LENGTH [commons-lang]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on code in PR #1559:
URL: https://github.com/apache/commons-lang/pull/1559#discussion_r2678590136
##########
src/main/java/org/apache/commons/lang3/ArrayUtils.java:
##########
@@ -194,9 +194,18 @@ public class ArrayUtils {
* The {@code SOFT_MAX_ARRAY_LENGTH} constant from Java's internal ArraySupport class.
*
* @since 3.19.0
+ * @deprecated Use {@link #MAX_ARRAY_LENGTH}.
*/
+ @Deprecated
public static int SOFT_MAX_ARRAY_LENGTH = Integer.MAX_VALUE - 8;
+ /**
+ * The {@code MAX_ARRAY_LENGTH} constant from Java's internal ArraySupport class.
+ *
+ * @since 3.21.0
+ */
+ public static final int MAX_ARRAY_LENGTH = Integer.MAX_VALUE - 8;
Review Comment:
Let's call the new one `SAFE_MAX_ARRAY_LENGTH`.
##########
src/main/java/org/apache/commons/lang3/ArrayUtils.java:
##########
@@ -194,9 +194,18 @@ public class ArrayUtils {
* The {@code SOFT_MAX_ARRAY_LENGTH} constant from Java's internal ArraySupport class.
*
* @since 3.19.0
+ * @deprecated Use {@link #MAX_ARRAY_LENGTH}.
Review Comment:
Let's say: `This variable will be final in 4.0; to guarantee immutability now, use {@link #SAFE_MAX_ARRAY_LENGTH}.`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org