[jira] [Commented] (GROOVY-8716) Could not find matching constructor for java.util.List()
[ https://issues.apache.org/jira/browse/GROOVY-8716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16561746#comment-16561746 ] paolo di tommaso commented on GROOVY-8716: -- That's good! > Could not find matching constructor for java.util.List() > > > Key: GROOVY-8716 > URL: https://issues.apache.org/jira/browse/GROOVY-8716 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: paolo di tommaso >Priority: Major > > The following Spock test fail > > {code:java} > class Foo extends Specification { > def 'should create a list' () { > given: > def folder = null > when: > List results = [] > then: > true > cleanup: > folder?.deleteDir() > } > }{code} > > The reported error is > {code:java} > org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast > object '[]' with class 'java.util.LinkedHashSet' to class 'java.util.List' > due to: groovy.lang.GroovyRuntimeException: Could not find matching > constructor for: java.util.List() > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8716) Could not find matching constructor for java.util.List()
[ https://issues.apache.org/jira/browse/GROOVY-8716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16560028#comment-16560028 ] Paul King commented on GROOVY-8716: --- I think it is the issue I mentioned above since it works with {{1.2-groovy-2.5-SNAPSHOT}} and {{1.2-groovy-2.5-SNAPSHOT}} when adding in the following snapshot repo: {code:java} repositories { maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } } {code} > Could not find matching constructor for java.util.List() > > > Key: GROOVY-8716 > URL: https://issues.apache.org/jira/browse/GROOVY-8716 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: paolo di tommaso >Priority: Major > > The following Spock test fail > > {code:java} > class Foo extends Specification { > def 'should create a list' () { > given: > def folder = null > when: > List results = [] > then: > true > cleanup: > folder?.deleteDir() > } > }{code} > > The reported error is > {code:java} > org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast > object '[]' with class 'java.util.LinkedHashSet' to class 'java.util.List' > due to: groovy.lang.GroovyRuntimeException: Could not find matching > constructor for: java.util.List() > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8716) Could not find matching constructor for java.util.List()
[ https://issues.apache.org/jira/browse/GROOVY-8716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16559332#comment-16559332 ] paolo di tommaso commented on GROOVY-8716: -- Even more strange, I've just realised that the error is caused by another method in the same class. For example: {code:java} class FooTest extends Specification { def 'should create a set' () { given: def folder = null when: Set results = [] then: true cleanup: folder?.deleteDir() } def 'should create a list' () { given: def folder = null when: List results = [] then: true cleanup: folder?.deleteDir() } } {code} I've created a GitHub project that replicates the issue at the following link https://github.com/pditommaso/groovy-issue-8716. > Could not find matching constructor for java.util.List() > > > Key: GROOVY-8716 > URL: https://issues.apache.org/jira/browse/GROOVY-8716 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: paolo di tommaso >Priority: Major > > The following Spock test fail > > {code:java} > class Foo extends Specification { > def 'should create a list' () { > given: > def folder = null > when: > List results = [] > then: > true > cleanup: > folder?.deleteDir() > } > }{code} > > The reported error is > {code:java} > org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast > object '[]' with class 'java.util.LinkedHashSet' to class 'java.util.List' > due to: groovy.lang.GroovyRuntimeException: Could not find matching > constructor for: java.util.List() > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8716) Could not find matching constructor for java.util.List()
[ https://issues.apache.org/jira/browse/GROOVY-8716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16559145#comment-16559145 ] Paul King commented on GROOVY-8716: --- Actually, I tried replicating above in the GroovyConsole and couldn't replicate the error. I tried JDK8 and JDK10 as well as 1.1-groovy-2.4, 1.2-groovy-2.4-SNAPSHOT, 1.2-groovy-2.5-SNAPSHOT versions. Can you elaborate the version you are using? I was trying to see if this fix was in the version you were testing against: https://github.com/spockframework/spock/pull/792 > Could not find matching constructor for java.util.List() > > > Key: GROOVY-8716 > URL: https://issues.apache.org/jira/browse/GROOVY-8716 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: paolo di tommaso >Priority: Major > > The following Spock test fail > > {code:java} > class Foo extends Specification { > def 'should create a list' () { > given: > def folder = null > when: > List results = [] > then: > true > cleanup: > folder?.deleteDir() > } > }{code} > > The reported error is > {code:java} > org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast > object '[]' with class 'java.util.LinkedHashSet' to class 'java.util.List' > due to: groovy.lang.GroovyRuntimeException: Could not find matching > constructor for: java.util.List() > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8716) Could not find matching constructor for java.util.List()
[ https://issues.apache.org/jira/browse/GROOVY-8716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558578#comment-16558578 ] Paul King commented on GROOVY-8716: --- It's possibly a Spock bug but we can leave this open until we determine that. > Could not find matching constructor for java.util.List() > > > Key: GROOVY-8716 > URL: https://issues.apache.org/jira/browse/GROOVY-8716 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: paolo di tommaso >Priority: Major > > The following Spock test fail > > {code:java} > class Foo extends Specification { > def 'should create a list' () { > given: > def folder = null > when: > List results = [] > then: > true > cleanup: > folder?.deleteDir() > } > }{code} > > The reported error is > {code:java} > org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast > object '[]' with class 'java.util.LinkedHashSet' to class 'java.util.List' > due to: groovy.lang.GroovyRuntimeException: Could not find matching > constructor for: java.util.List() > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8716) Could not find matching constructor for java.util.List()
[ https://issues.apache.org/jira/browse/GROOVY-8716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558422#comment-16558422 ] paolo di tommaso commented on GROOVY-8716: -- I guess no. I've noticed that just removing the `given` or `cleanup` component, it pass. > Could not find matching constructor for java.util.List() > > > Key: GROOVY-8716 > URL: https://issues.apache.org/jira/browse/GROOVY-8716 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: paolo di tommaso >Priority: Major > > The following Spock test fail > > {code:java} > class Foo extends Specification { > def 'should create a list' () { > given: > def folder = null > when: > List results = [] > then: > true > cleanup: > folder?.deleteDir() > } > }{code} > > The reported error is > {code:java} > org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast > object '[]' with class 'java.util.LinkedHashSet' to class 'java.util.List' > due to: groovy.lang.GroovyRuntimeException: Could not find matching > constructor for: java.util.List() > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8716) Could not find matching constructor for java.util.List()
[ https://issues.apache.org/jira/browse/GROOVY-8716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558421#comment-16558421 ] Paul King commented on GROOVY-8716: --- Does the same test without Spock fail? > Could not find matching constructor for java.util.List() > > > Key: GROOVY-8716 > URL: https://issues.apache.org/jira/browse/GROOVY-8716 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: paolo di tommaso >Priority: Major > > The following Spock test fail > > {code:java} > class Foo extends Specification { > def 'should create a list' () { > given: > def folder = null > when: > List results = [] > then: > true > cleanup: > folder?.deleteDir() > } > }{code} > > The reported error is > {code:java} > org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast > object '[]' with class 'java.util.LinkedHashSet' to class 'java.util.List' > due to: groovy.lang.GroovyRuntimeException: Could not find matching > constructor for: java.util.List() > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)