Skip to content

HBASE-29273 Remove deprecated boxed primitive constructors in some test classes #6949

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

Merged
merged 1 commit into from
Jun 5, 2025

Conversation

guluo2016
Copy link
Contributor

Details see: HBASE-29273

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache9 Apache9 requested a review from Copilot April 28, 2025 02:43
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the use of deprecated boxed primitive constructors in various test classes as part of HBASE-29273, ensuring more modern and idiomatic Java usage in tests.

  • Replaces deprecated constructors in TestLogRolling, TestScannerWithBulkload, TestDeadServer, TestHFileDataBlockEncoder, TestTimestampsFilter, and TestMultiParallel.
  • Updates object boxing to use autoboxing or factory methods such as Integer.valueOf and Long.valueOf.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java Removed deprecated new Integer(1) usage in favor of literal 1.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerWithBulkload.java Replaced new Long(9999999) with Long.valueOf(9999999).
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDeadServer.java Updated new Long values to Long.valueOf for assertions.
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileDataBlockEncoder.java Removed deprecated new Boolean(...) usage by directly passing includesMemstoreTS.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTimestampsFilter.java Changed new Long(3) to 3L in timestamp addition.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java Replaced new Integer(...) with Integer.valueOf(...).
Comments suppressed due to low confidence (2)

hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java:146

  • [nitpick] Consider simplifying the integer to byte conversion by using a direct cast, e.g., (byte)(i % 256), which improves readability.
cp[k.length] = Integer.valueOf(i % 256).byteValue();

hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java:159

  • [nitpick] Consider simplifying the integer to byte conversion by using a direct cast, e.g., (byte)(i % 256), which improves readability.
cp[k.length] = Integer.valueOf(i % 256).byteValue();

@@ -143,7 +143,7 @@ private static byte[][] makeKeys() {
byte[] k = starterKeys[kIdx];
byte[] cp = new byte[k.length + 1];
System.arraycopy(k, 0, cp, 0, k.length);
cp[k.length] = new Integer(i % 256).byteValue();
cp[k.length] = Integer.valueOf(i % 256).byteValue();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Apache9 for triggering the GitHub Copilot review!
These nitpicks seem reasonable in here and i will apply the changes.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@guluo2016 guluo2016 force-pushed the hbase_HBASE-29273 branch from 60cb790 to ff45659 Compare June 4, 2025 11:47
@guluo2016
Copy link
Contributor Author

Squashed the commits and trigger a rebuild.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 28s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
_ master Compile Tests _
+1 💚 mvninstall 3m 26s master passed
+1 💚 compile 3m 22s master passed
+1 💚 checkstyle 0m 37s master passed
+1 💚 spotbugs 1m 37s master passed
+1 💚 spotless 0m 50s branch has no errors when running spotless:check.
_ Patch Compile Tests _
+1 💚 mvninstall 3m 6s the patch passed
+1 💚 compile 3m 19s the patch passed
-0 ⚠️ javac 3m 19s /results-compile-javac-hbase-server.txt hbase-server generated 1 new + 192 unchanged - 1 fixed = 193 total (was 193)
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 36s the patch passed
+1 💚 spotbugs 1m 40s the patch passed
+1 💚 hadoopcheck 12m 10s Patch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚 spotless 0m 45s patch has no errors when running spotless:check.
_ Other Tests _
+1 💚 asflicense 0m 11s The patch does not generate ASF License warnings.
40m 2s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6949/5/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #6949
Optional Tests dupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
uname Linux b68d19706625 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / ff45659
Default Java Eclipse Adoptium-17.0.11+9
Max. process+thread count 89 (vs. ulimit of 30000)
modules C: hbase-server U: hbase-server
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6949/5/console
versions git=2.34.1 maven=3.9.8 spotbugs=4.7.3
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 30s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 3m 18s master passed
+1 💚 compile 0m 58s master passed
+1 💚 javadoc 0m 28s master passed
+1 💚 shadedjars 6m 8s branch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 3m 7s the patch passed
+1 💚 compile 0m 58s the patch passed
+1 💚 javac 0m 58s hbase-server generated 0 new + 11 unchanged - 8 fixed = 11 total (was 19)
+1 💚 javadoc 0m 27s the patch passed
+1 💚 shadedjars 6m 3s patch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚 unit 258m 29s hbase-server in the patch passed.
286m 22s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6949/5/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR #6949
Optional Tests javac javadoc unit compile shadedjars
uname Linux 2a92484ee04e 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / ff45659
Default Java Eclipse Adoptium-17.0.11+9
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6949/5/testReport/
Max. process+thread count 4414 (vs. ulimit of 30000)
modules C: hbase-server U: hbase-server
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6949/5/console
versions git=2.34.1 maven=3.9.8
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache9 Apache9 merged commit d84824b into apache:master Jun 5, 2025
1 check passed
Apache9 pushed a commit that referenced this pull request Jun 5, 2025
…st classes (#6949)

Signed-off-by: Duo Zhang <[email protected]>
(cherry picked from commit d84824b)
Apache9 pushed a commit that referenced this pull request Jun 5, 2025
…st classes (#6949)

Signed-off-by: Duo Zhang <[email protected]>
(cherry picked from commit d84824b)
Apache9 pushed a commit that referenced this pull request Jun 5, 2025
…st classes (#6949)

Signed-off-by: Duo Zhang <[email protected]>
(cherry picked from commit d84824b)
Apache9 pushed a commit that referenced this pull request Jun 5, 2025
…st classes (#6949)

Signed-off-by: Duo Zhang <[email protected]>
(cherry picked from commit d84824b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants