[ 
https://issues.apache.org/jira/browse/GROOVY-11136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17747687#comment-17747687
 ] 

Paul King commented on GROOVY-11136:
------------------------------------

Looks like some tests are still using JDK8 code too:
[https://ci.groovy-lang.org/buildConfiguration/Groovy_Groovy25xTestJdk7/15636?hideProblemsFromDependencies=false&hideTestsFromDependencies=false&expandBuildProblemsSection=true&expandBuildChangesSection=true&expandBuildTestsSection=true]

TestScripttestShouldUseMethodGenericType16220.groovy: 4: [Static type checking] 
- Cannot find matching method java.lang.Iterable#forEach(groovy.lang.Closure). 
Please check if the declared type is correct and if the method exists. @ line 
4, column 17. iterable.forEach \{ result.add(it) }

groovy.bugs.Groovy8815.testGenerics(Groovy8815.groovy:65)
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: 
/var/teamcity/buildAgent_jdk8/temp/buildTmp/groovy-generated-tmpdir-327503358089931732/Events.groovy:
 3: unable to resolve class java.util.function.Consumer @ line 3, column 17. 
/var/teamcity/buildAgent_jdk8/temp/buildTmp/groovy-generated-tmpdir-327503358089931732/Events.groovy:
 6: unable to resolve class java.util.function.Consumer @ line 6, column 67. 2 
errors

 

TestScripttestShouldUseMethodGenericType16422.groovy: 4: [Static type checking] 
- Cannot find matching method java.lang.Iterable#forEach(groovy.lang.Closure). 
Please check if the declared type is correct and if the method exists. @ line 
4, column 17. iterable.forEach \{ result.add(it) }

They can be backported or moved into a test with a vm8 package or have a guard 
that tests version.

 

> NoSuchMethodError thrown when executing Groovy script
> -----------------------------------------------------
>
>                 Key: GROOVY-11136
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11136
>             Project: Groovy
>          Issue Type: Bug
>          Components: ast builder, Compiler
>    Affects Versions: 2.5.22
>         Environment: Java 1.7
>            Reporter: Pan Jian
>            Assignee: Eric Milles
>            Priority: Critical
>             Fix For: 2.5.23
>
>         Attachments: CI.png, SystemRequirements.png, demo.groovy, error.png
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> v2.5.x is for Java 1.7.
> {{GROOVY_2_5_X}} branch has a method called {{getOrDefault}} that raises 
> {{NoSuchMethodError}} because {{Map.getOrDefault}} was introduced in Java 1.8.
> [https://github.com/apache/groovy/blob/GROOVY_2_5_X/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java#L426C66-L426C78]
> [https://github.com/apache/groovy/commit/ccfd6053d1b52488577bcdb2ee4693b1cf907f10#diff-44c9e077575ae7093626dbc9bb5f59df0483975e7af0b87f62dc4a98aa5f4ecbR426]
> [https://docs.oracle.com/javase/7/docs/api/java/lang/NoSuchMethodError.html]
> [https://docs.oracle.com/javase/8/docs/api/java/util/Map.html#getOrDefault-java.lang.Object-V-]
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to