This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git


The following commit(s) were added to refs/heads/master by this push:
     new 605f516  Use isEmpty().
605f516 is described below

commit 605f5165a770dc6a265e003195d6a097977adf19
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Jan 16 21:52:28 2021 -0500

    Use isEmpty().
---
 src/examples/Mini/MiniC.java                                 | 2 +-
 src/main/java/org/apache/bcel/generic/InstructionHandle.java | 2 +-
 src/main/java/org/apache/bcel/generic/MethodGen.java         | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/examples/Mini/MiniC.java b/src/examples/Mini/MiniC.java
index 5c93758..4b333d9 100644
--- a/src/examples/Mini/MiniC.java
+++ b/src/examples/Mini/MiniC.java
@@ -143,7 +143,7 @@ public class MiniC implements org.apache.bcel.Constants {
           }
         }
 
-        if((errors.size() > 0) || (warnings.size() > 0)) {
+        if((!errors.isEmpty()) || (!warnings.isEmpty())) {
         System.out.println(errors.size() + " errors and " + warnings.size() +
                              " warnings.");
     }
diff --git a/src/main/java/org/apache/bcel/generic/InstructionHandle.java 
b/src/main/java/org/apache/bcel/generic/InstructionHandle.java
index 0441339..76b3122 100644
--- a/src/main/java/org/apache/bcel/generic/InstructionHandle.java
+++ b/src/main/java/org/apache/bcel/generic/InstructionHandle.java
@@ -219,7 +219,7 @@ public class InstructionHandle {
 
 
     public boolean hasTargeters() {
-        return (targeters != null) && (targeters.size() > 0);
+        return (targeters != null) && (!targeters.isEmpty());
     }
 
 
diff --git a/src/main/java/org/apache/bcel/generic/MethodGen.java 
b/src/main/java/org/apache/bcel/generic/MethodGen.java
index b127e46..ca561be 100644
--- a/src/main/java/org/apache/bcel/generic/MethodGen.java
+++ b/src/main/java/org/apache/bcel/generic/MethodGen.java
@@ -682,7 +682,7 @@ public class MethodGen extends FieldGenOrMethodGen {
         LocalVariableTable lvt = null;
         /* Create LocalVariableTable and LineNumberTable attributes (for 
debuggers, e.g.)
          */
-        if ((variableList.size() > 0) && !stripAttributes) {
+        if ((!variableList.isEmpty()) && !stripAttributes) {
             updateLocalVariableTable(getLocalVariableTable(_cp));
             addCodeAttribute(lvt = getLocalVariableTable(_cp));
         }
@@ -693,7 +693,7 @@ public class MethodGen extends FieldGenOrMethodGen {
             }
             addCodeAttribute(localVariableTypeTable);
         }
-        if ((lineNumberList.size() > 0) && !stripAttributes) {
+        if ((!lineNumberList.isEmpty()) && !stripAttributes) {
             addCodeAttribute(lnt = getLineNumberTable(_cp));
         }
         final Attribute[] code_attrs = getCodeAttributes();
@@ -723,7 +723,7 @@ public class MethodGen extends FieldGenOrMethodGen {
         final Attribute[] annotations = addRuntimeAnnotationsAsAttribute(_cp);
         final Attribute[] parameterAnnotations = 
addRuntimeParameterAnnotationsAsAttribute(_cp);
         ExceptionTable et = null;
-        if (throwsList.size() > 0) {
+        if (!throwsList.isEmpty()) {
             addAttribute(et = getExceptionTable(_cp));
             // Add `Exceptions' if there are "throws" clauses
         }
@@ -1143,7 +1143,7 @@ public class MethodGen extends FieldGenOrMethodGen {
             }
         }
 
-        if (throwsList.size() > 0) {
+        if (!throwsList.isEmpty()) {
             for (final String throwsDescriptor : throwsList) {
                 buf.append("\n\t\tthrows ").append(throwsDescriptor);
             }

Reply via email to