groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Redundant nullcheck of value known to be non-null
Date Wed, 07 Feb 2018 05:36:16 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X 05a1a9144 -> b1cc4fcc7


Redundant nullcheck of value known to be non-null

(cherry picked from commit ffb33c5)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/b1cc4fcc
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/b1cc4fcc
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/b1cc4fcc

Branch: refs/heads/GROOVY_2_6_X
Commit: b1cc4fcc7443b49b80db2e5b5dbfe59880cf6acb
Parents: 05a1a91
Author: sunlan <sunlan@apache.org>
Authored: Wed Feb 7 12:32:32 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Wed Feb 7 13:36:07 2018 +0800

----------------------------------------------------------------------
 src/main/groovy/groovy/grape/GrabAnnotationTransformation.java     | 2 +-
 .../codehaus/groovy/classgen/asm/OptimizingStatementWriter.java    | 1 -
 src/main/java/org/codehaus/groovy/util/ManagedLinkedList.java      | 2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/b1cc4fcc/src/main/groovy/groovy/grape/GrabAnnotationTransformation.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/grape/GrabAnnotationTransformation.java b/src/main/groovy/groovy/grape/GrabAnnotationTransformation.java
index dd55ff9..e21e608 100644
--- a/src/main/groovy/groovy/grape/GrabAnnotationTransformation.java
+++ b/src/main/groovy/groovy/grape/GrabAnnotationTransformation.java
@@ -321,7 +321,7 @@ public class GrabAnnotationTransformation extends ClassCodeVisitorSupport
implem
                         if (member == null) {
                             addError("The missing attribute \"" + s + "\" is required in
@" + node.getClassNode().getNameWithoutPackage() + " annotations", node);
                             continue grabExcludeAnnotationLoop;
-                        } else if (member != null && !(member instanceof ConstantExpression))
{
+                        } else if (!(member instanceof ConstantExpression)) {
                             addError("Attribute \"" + s + "\" has value " + member.getText()
+ " but should be an inline constant in @" + node.getClassNode().getNameWithoutPackage() +
" annotations", node);
                             continue grabExcludeAnnotationLoop;
                         }

http://git-wip-us.apache.org/repos/asf/groovy/blob/b1cc4fcc/src/main/java/org/codehaus/groovy/classgen/asm/OptimizingStatementWriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/classgen/asm/OptimizingStatementWriter.java
b/src/main/java/org/codehaus/groovy/classgen/asm/OptimizingStatementWriter.java
index e553477..1539706 100644
--- a/src/main/java/org/codehaus/groovy/classgen/asm/OptimizingStatementWriter.java
+++ b/src/main/java/org/codehaus/groovy/classgen/asm/OptimizingStatementWriter.java
@@ -327,7 +327,6 @@ public class OptimizingStatementWriter extends StatementWriter {
             super.writeIfElse(statement);
             fastPathBlocked = oldFastPathBlock;
 
-            if (fastPathData == null) return;
             writeFastPathPrelude(fastPathData);
             super.writeIfElse(statement);
             writeFastPathEpilogue(fastPathData);

http://git-wip-us.apache.org/repos/asf/groovy/blob/b1cc4fcc/src/main/java/org/codehaus/groovy/util/ManagedLinkedList.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/util/ManagedLinkedList.java b/src/main/java/org/codehaus/groovy/util/ManagedLinkedList.java
index 4b7b37c..17fa266 100644
--- a/src/main/java/org/codehaus/groovy/util/ManagedLinkedList.java
+++ b/src/main/java/org/codehaus/groovy/util/ManagedLinkedList.java
@@ -71,7 +71,7 @@ public class ManagedLinkedList<T> {
             if (currentHandled) {
                 return current.next != null;
             } else {
-                return current != null;
+                return true;
             }
         }
 


Mime
View raw message