Add Exception Handling for Unsupported Object Types in isEmpty Method #33505
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: declined
A suggestion or change that we don't feel we should currently apply
The current isEmpty method is designed to check if various types of objects are empty.
However, if an unsupported object type is accidentally passed, the method simply returns
false
.This can cause confusion when incorrect input is provided, making it difficult to detect bugs early.
Proposal:
I propose that when an unsupported object type is passed to the isEmpty method, instead of returning false, the method should throw a clear exception (
IllegalArgumentException
), making it obvious that an unsupported type was provided.The text was updated successfully, but these errors were encountered: