This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push:
new d8d0a028c Fix sign extension in BitField.getValue for top-bit fields
(#1749).
d8d0a028c is described below
commit d8d0a028ce1469a93d2a6aa835c305eba22d8338
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Jul 17 07:12:06 2026 -0700
Fix sign extension in BitField.getValue for top-bit fields (#1749).
---
src/changes/changes.xml | 1 +
src/test/java/org/apache/commons/lang3/BitFieldTest.java | 2 ++
2 files changed, 3 insertions(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 68d4fb59c..397792eaa 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -226,6 +226,7 @@ java.lang.NullPointerException: Cannot invoke
<action type="fix" dev="ggregory" due-to="alhudz, Gary
Gregory">Fix FieldUtils.getField false ambiguity on inherited interface field
(#1748).</action>
<action type="fix" dev="ggregory" due-to="Sarankumar
Baskar, Gary Gregory">Skip Chuvash locale parser tests on Java 27
(#1746).</action>
<action type="fix" dev="ggregory" due-to="alhudz, Gary
Gregory">Fix ArrayUtils.reverse range underflow on Integer.MIN_VALUE end
(#1750).</action>
+ <action type="fix" dev="ggregory" due-to="alhudz, Gary
Gregory">Fix sign extension in BitField.getValue for top-bit fields
(#1749).</action>
<!-- ADD -->
<action type="add" dev="ggregory" due-to="Gary
Gregory">Add JavaVersion.JAVA_27.</action>
<action type="add" dev="ggregory" due-to="Gary
Gregory">Add SystemUtils.IS_JAVA_27.</action>
diff --git a/src/test/java/org/apache/commons/lang3/BitFieldTest.java
b/src/test/java/org/apache/commons/lang3/BitFieldTest.java
index 7c5fffd1f..f6adc80fd 100644
--- a/src/test/java/org/apache/commons/lang3/BitFieldTest.java
+++ b/src/test/java/org/apache/commons/lang3/BitFieldTest.java
@@ -154,6 +154,8 @@ void testGetValueTopBit() {
assertEquals(topByte.getValue(0xFF000000), 255);
// The int and long overloads must agree for the same field and holder.
assertEquals(topByte.getValue(0xFF000000L), 255L);
+ // Verify the int and long overloads agree for the same field and
holder.
+ assertEquals(topByte.getValue(0xFF000000L), (long)
topByte.getValue(0xFF000000));
final BitField bit63 = new BitField(0x8000000000000000L);
assertEquals(bit63.getValue(0x8000000000000000L), 1L);
assertEquals(bit63.getValue(0L), 0L);