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

Replace .size() == 0 with isEmpty() #274

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
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 @@ -65,7 +65,7 @@ public Version(final int newMajor, final int newMinor, final int newRevision, fi
major = newMajor;
minor = newMinor;
revision = newRevision;
if (newTag == null || newTag.length() != 0) {
if (newTag == null || !newTag.isEmpty()) {
tag = newTag;
} else {
tag = null;
Expand Down Expand Up @@ -109,7 +109,7 @@ public Version(final int newMajor) {
* @return The version parsed from the string
*/
public static Version parseFromString(final String version) {
if (version == null || version.length() == 0) {
if (version == null || version.isEmpty()) {
throw new IllegalArgumentException("Version must not be null or empty.");
}
String[] split = version.split("[._-]", 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ protected Properties setupProperties() {
@SuppressWarnings({"rawtypes", "unchecked"})
protected List<?> setupLinks() throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, InstantiationException {
List linksList = new ArrayList();
if (links != null && links.size() > 0) {
if (links != null && !links.isEmpty()) {
Class<?> linkArgumentClass = null;
if (this.linkArgumentClass == null) {
if (groovyAtLeast(GROOVY_1_6_0_RC2)) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/codehaus/gmavenplus/util/ClassWrangler.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public String getGroovyVersionString() {
try {
Class<?> groovySystemClass = getClass("groovy.lang.GroovySystem");
String ver = (String) invokeStaticMethod(findMethod(groovySystemClass, "getVersion"));
if (ver != null && ver.length() > 0) {
if (ver != null && !ver.isEmpty()) {
groovyVersion = ver;
}
} catch (ClassNotFoundException | IllegalArgumentException | InvocationTargetException | IllegalAccessException e) {
Expand All @@ -98,7 +98,7 @@ public String getGroovyVersionString() {
try {
Class<?> invokerHelperClass = getClass("org.codehaus.groovy.runtime.InvokerHelper");
String ver = (String) invokeStaticMethod(findMethod(invokerHelperClass, "getVersion"));
if (ver != null && ver.length() > 0) {
if (ver != null && !ver.isEmpty()) {
groovyVersion = ver;
}
} catch (ClassNotFoundException | IllegalArgumentException | InvocationTargetException | IllegalAccessException e) {
Expand Down