JDK-8373661 : Add edge case tests for Objects.requireNonNull methods
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util
  • Priority: P4
  • Status: New
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2025-12-14
  • Updated: 2025-12-15
Description
ADDITIONAL SYSTEM INFORMATION :
Operating System: darwin 24.6.0 (macOS)
JDK Version: openjdk version "21" 2023-09-19 LTS
Build: OpenJDK Runtime Environment (build 21+35-LTS)
Architecture: x86_64

Additional Information:
- Working on OpenJDK JDK repository
- Testing with jtreg test framework

A DESCRIPTION OF THE PROBLEM :
I would like to contribute to OpenJDK by adding comprehensive 
edge case tests for Objects.requireNonNull, requireNonNullElse, 
and requireNonNullElseGet methods to improve test coverage.

Motivation:
The current test suite for Objects.requireNonNull methods covers 
basic cases but lacks edge case coverage. This enhancement will 
improve the overall test quality and help ensure API correctness.

Proposed Changes:
- Add test for requireNonNull with null Supplier parameter
- Add test for requireNonNull with Supplier throwing exception
- Add test for requireNonNullElse with both arguments null
- Add test for requireNonNullElseGet with null supplier
- Add test for requireNonNullElseGet with supplier returning null

Testing:
All new tests will be added to test/jdk/java/util/Objects/
BasicObjectsTest.java following jtreg test format.

This is my first contribution to OpenJDK. I'm ready to submit 
a pull request once a JBS issue is created.



Comments
Informed the submitter to send the proposed changes/fixes to https://mail.openjdk.org/mailman/listinfo/core-libs-devto for more discussions.
15-12-2025