You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2022/02/09 20:12:27 UTC

[groovy] branch master updated: safety check

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 <er...@thomsonreuters.com>
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);