Skip to content

Deprecate StringUtils.isEmpty(Object) and replace remaining usage (e.g. with ObjectUtils.isEmpty) #25945

@sabi0

Description

@sabi0

With static imports code like this looks perfectly fine:

        List<String> data = ...

        if (isEmpty(data)) {

But if the import has StringUtils.isEmpty the condition above will not work correctly for empty List introducing a hidden, difficult to spot bug.

If you are really keen on keeping this method it would be better to rename it to isEmptyString to at least make the error more obvious. (I believe this name also matches the method intention better than generic isEmpty.)

But with the #17710 in place I do not think StringUtils.isEmpty(Object) is still needed. And should probably be deprecated and eventually removed.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions