You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2018/05/04 07:28:02 UTC
groovy git commit: backport an extra guard check from 2_5_X
Repository: groovy
Updated Branches:
refs/heads/GROOVY_2_4_X 8e3965a54 -> c80d02b13
backport an extra guard check from 2_5_X
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/c80d02b1
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/c80d02b1
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/c80d02b1
Branch: refs/heads/GROOVY_2_4_X
Commit: c80d02b13005efd87eb69ca66958def9becc56e1
Parents: 8e3965a
Author: Daniel Sun <re...@hotmail.com>
Authored: Fri May 4 17:27:33 2018 +1000
Committer: Paul King <pa...@asert.com.au>
Committed: Fri May 4 17:27:33 2018 +1000
----------------------------------------------------------------------
.../transform/stc/StaticTypeCheckingVisitor.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/c80d02b1/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
index dbc5dc6..595d310 100644
--- a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++ b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -4345,13 +4345,15 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport {
final Parameter[] parameters = closureExpression.getParameters();
String name = parameter.getName();
- if (parameters.length == 0) {
- return "it".equals(name) && closureParamTypes.length != 0 ? closureParamTypes[0] : null;
- }
+ if (parameters != null) {
+ if (parameters.length == 0) {
+ return "it".equals(name) && closureParamTypes.length != 0 ? closureParamTypes[0] : null;
+ }
- for (int index = 0; index < parameters.length; index++) {
- if (name.equals(parameters[index].getName())) {
- return closureParamTypes.length > index ? closureParamTypes[index] : null;
+ for (int index = 0; index < parameters.length; index++) {
+ if (name.equals(parameters[index].getName())) {
+ return closureParamTypes.length > index ? closureParamTypes[index] : null;
+ }
}
}