Skip to content

Commit

Permalink
Merge pull request #274 from groovy/replace-size-0-with-isempty
Browse files Browse the repository at this point in the history
Replace `.size() == 0` with `isEmpty()`
  • Loading branch information
keeganwitt committed Sep 26, 2023
2 parents b5bc559 + 089268e commit e6cd3e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
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
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
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

0 comments on commit e6cd3e1

Please sign in to comment.