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

emilles pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 47730ca  safety check
47730ca is described below

commit 47730caba0dacf5f9086f793b7e347c89dc49e3b
Author: Eric Milles <[email protected]>
AuthorDate: Wed Feb 9 13:44:16 2022 -0600

    safety check
---
 .../org/codehaus/groovy/classgen/asm/sc/StaticTypesStatementWriter.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesStatementWriter.java
 
b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesStatementWriter.java
index fe28544..4a54a0e 100644
--- 
a/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesStatementWriter.java
+++ 
b/src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesStatementWriter.java
@@ -223,7 +223,7 @@ public class StaticTypesStatementWriter extends 
StatementWriter {
                     .map(in -> in.getMethod("iterator", Parameter.EMPTY_ARRAY))
                     .filter(Objects::nonNull).findFirst().orElse(null);
         }
-        if (iterator != null) {
+        if (iterator != null && 
GeneralUtils.isOrImplements(iterator.getReturnType(), 
ClassHelper.Iterator_TYPE)) {
             MethodCallExpression call = 
GeneralUtils.callX(collectionExpression, "iterator");
             call.setImplicitThis(false);
             call.setMethodTarget(iterator);

Reply via email to