Skip to content
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

[MSHARED-1172] Deprecate redundant isEmptyString method #123

Merged
merged 4 commits into from
Jan 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ private static boolean isMergeChildren( Xpp3Dom dominant )
}

/**
* @param str The string to be checked.
* @return <code>true</code> in case string is empty <code>false</code> otherwise.
* @deprecated use <code>str == null || String.isBlank(str)</code> (Java 11+)
Copy link
Member

Choose a reason for hiding this comment

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

Why not recommending https://github.com/apache/maven-shared-utils/blob/f4383c55f77ad4480f146481bf3192bc52c3af30/src/main/java/org/apache/maven/shared/utils/StringUtils.java#L145 as replacement? Or should we rather deprecate that method as well?

Copy link
Member

Choose a reason for hiding this comment

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

This is fine as well

Copy link
Contributor Author

@elharo elharo Jan 1, 2023

Choose a reason for hiding this comment

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

IMHO

JDK > org,apache.commons > Guava > maven-shared-utils > plexus-utils > random classes where it doesn't belong

Realistically, this method is reinvented so often and so frequently, we'll never get down to a single version. However this case is particularly egregious.

* or <code>org.apache.commons.lang3.StringUtils.isBlank(str)</code>
* @param str the string to be checked
* @return <code>true</code> if the string is null, empty, or whitespace only; <code>false</code> otherwise
*/
@Deprecated
public static boolean isEmpty( String str )
{
return str == null || str.trim().length() == 0;
}




}