[jira] [Commented] (GROOVY-8363) Implementing List with a delegated data source results in StackOverflowException
[ https://issues.apache.org/jira/browse/GROOVY-8363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16213426#comment-16213426 ] Paul King commented on GROOVY-8363: --- I haven't really looked into it but I suspect that if for instance getting the delegate involves calculating it's size() then that will involve getting the delegate ... doesn't mean there isn't a bug in there somewhere. I'd probably re-write slightly to something like (tested with 2.5.0-beta-2): {code} import groovy.transform.CompileStatic class DelegateList { private List lowerCaseStrings = [] private List upperCaseStrings = new DelegatingListImplementation() private abstract static class DelegatingList { @Delegate abstract List getDelegate() } @CompileStatic private class DelegatingListImplementation extends DelegatingList { @Override List getDelegate() { lowerCaseStrings*.toUpperCase() } } DelegateList(Collection strings) { lowerCaseStrings = strings*.toLowerCase() } List getUppercase() { return upperCaseStrings } static void main(args) { def d = new DelegateList(['hello', 'bye']) println d.uppercase } } {code} > Implementing List with a delegated data source results in > StackOverflowException > > > Key: GROOVY-8363 > URL: https://issues.apache.org/jira/browse/GROOVY-8363 > Project: Groovy > Issue Type: Bug >Reporter: Kevin Chen > > Preface: not experienced with submitting bugs to the Groovy project, so > please bear with me if anything's unclear. > I'm getting a StackOverflowException from this bit of code (I think just > including this snippet demonstrates better than I can explain verbally): > {code:title=DelegateList.groovy|borderStyle=solid} > class DelegateList { > private List lowerCaseStrings = [] > private DelegatingListImplementation uppercaseStrings = new > DelegatingListImplementation() > private abstract static class DelegatingList implements List { > abstract List getDelegate() > @Override > int size() { > return delegate.size() > } > @Override > boolean isEmpty() { > return delegate.isEmpty() > } > // etc. > } > private class DelegatingListImplementation extends DelegatingList { > @Override > List getDelegate() { > return lowerCaseStrings.collect { it.toUpperCase() } > } > } > DelegateList(Collection strings) { > lowerCaseStrings = strings.toList().collect { it.toLowerCase() } > } > List getUppercase() { > return uppercaseStrings > } > public static void main(String[] args) { > def d = new DelegateList(['hello', 'bye']) > println d.getUppercase() // StackOverflowError > } > } > {code} > The equivalent doesn't happen in Java. Example repository with both runnables > is here: [https://github.com/aspin/groovy-delegate-list]. I'm not really sure > how to get deeper into the source of this (Groovy's closure resolving > strategies?) and/or how to work around. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GROOVY-8363) Implementing List with a delegated data source results in StackOverflowException
[ https://issues.apache.org/jira/browse/GROOVY-8363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16213257#comment-16213257 ] Kevin Chen commented on GROOVY-8363: History is just me figuring out the {{code}} tag, my bad. > Implementing List with a delegated data source results in > StackOverflowException > > > Key: GROOVY-8363 > URL: https://issues.apache.org/jira/browse/GROOVY-8363 > Project: Groovy > Issue Type: Bug >Reporter: Kevin Chen > > Preface: not experienced with submitting bugs to the Groovy project, so > please bear with me if anything's unclear. > I'm getting a StackOverflowException from this bit of code (I think just > including this snippet demonstrates better than I can explain verbally): > {code:title=DelegateList.groovy|borderStyle=solid} > class DelegateList { > private List lowerCaseStrings = [] > private DelegatingListImplementation uppercaseStrings = new > DelegatingListImplementation() > private abstract static class DelegatingList implements List { > abstract List getDelegate() > @Override > int size() { > return delegate.size() > } > @Override > boolean isEmpty() { > return delegate.isEmpty() > } > // etc. > } > private class DelegatingListImplementation extends DelegatingList { > @Override > List getDelegate() { > return lowerCaseStrings.collect { it.toUpperCase() } > } > } > DelegateList(Collection strings) { > lowerCaseStrings = strings.toList().collect { it.toLowerCase() } > } > List getUppercase() { > return uppercaseStrings > } > public static void main(String[] args) { > def d = new DelegateList(['hello', 'bye']) > println d.getUppercase() // StackOverflowError > } > } > {code} > The equivalent doesn't happen in Java. Example repository with both runnables > is here: [https://github.com/aspin/groovy-delegate-list]. I'm not really sure > how to get deeper into the source of this (Groovy's closure resolving > strategies?) and/or how to work around. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (GROOVY-8363) Implementing List with a delegated data source results in StackOverflowException
[ https://issues.apache.org/jira/browse/GROOVY-8363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kevin Chen updated GROOVY-8363: --- Description: Preface: not experienced with submitting bugs to the Groovy project, so please bear with me if anything's unclear. I'm getting a StackOverflowException from this bit of code (I think just including this snippet demonstrates better than I can explain verbally): {code:title=DelegateList.groovy|borderStyle=solid} class DelegateList { private List lowerCaseStrings = [] private DelegatingListImplementation uppercaseStrings = new DelegatingListImplementation() private abstract static class DelegatingList implements List { abstract List getDelegate() @Override int size() { return delegate.size() } @Override boolean isEmpty() { return delegate.isEmpty() } // etc. } private class DelegatingListImplementation extends DelegatingList { @Override List getDelegate() { return lowerCaseStrings.collect { it.toUpperCase() } } } DelegateList(Collection strings) { lowerCaseStrings = strings.toList().collect { it.toLowerCase() } } List getUppercase() { return uppercaseStrings } public static void main(String[] args) { def d = new DelegateList(['hello', 'bye']) println d.getUppercase() // StackOverflowError } } {code} The equivalent doesn't happen in Java. Example repository with both runnables is here: [https://github.com/aspin/groovy-delegate-list]. I'm not really sure how to get deeper into the source of this (Groovy's closure resolving strategies?) and/or how to work around. was: Preface: not experienced with submitting bugs to the Groovy project, so please bear with me if anything's unclear. I'm getting a {{StackOverflowException}} from this bit of code (I think just including this snippet demonstrates better than I can explain verbally): {{ class DelegateList { private List lowerCaseStrings = [] private DelegatingListImplementation uppercaseStrings = new DelegatingListImplementation() private abstract static class DelegatingList implements List { abstract List getDelegate() @Override int size() { return delegate.size() } @Override boolean isEmpty() { return delegate.isEmpty() } // etc. } private class DelegatingListImplementation extends DelegatingList { @Override List getDelegate() { return lowerCaseStrings.collect { it.toUpperCase() } } } DelegateList(Collection strings) { lowerCaseStrings = strings.toList().collect { it.toLowerCase() } } List getUppercase() { return uppercaseStrings } public static void main(String[] args) { def d = new DelegateList(['hello', 'bye']) println d.getUppercase() // StackOverflowError } } }} The equivalent doesn't happen in Java. Example repository with both runnables is here: [https://github.com/aspin/groovy-delegate-list]. I'm not really sure how to get deeper into the source of this (Groovy's closure resolving strategies?) and/or how to work around. > Implementing List with a delegated data source results in > StackOverflowException > > > Key: GROOVY-8363 > URL: https://issues.apache.org/jira/browse/GROOVY-8363 > Project: Groovy > Issue Type: Bug >Reporter: Kevin Chen > > Preface: not experienced with submitting bugs to the Groovy project, so > please bear with me if anything's unclear. > I'm getting a StackOverflowException from this bit of code (I think just > including this snippet demonstrates better than I can explain verbally): > {code:title=DelegateList.groovy|borderStyle=solid} > class DelegateList { > private List lowerCaseStrings = [] > private DelegatingListImplementation uppercaseStrings = new > DelegatingListImplementation() > private abstract static class DelegatingList implements List { > abstract List getDelegate() > @Override > int size() { > return delegate.size() > } > @Override > boolean isEmpty() { > return delegate.isEmpty() > } > // etc. > } > private class DelegatingListImplementation extends DelegatingList { > @Override > List getDelegate() { > return lowerCaseStrings.collect { it.toUpperCase() } > } > } > DelegateList(Collection strings) { > lowerCaseStrings = strings.toList().collect { it.toLowerCase() } > } > List getUppercase() { > return uppercaseStrings > } > public static void
[jira] [Updated] (GROOVY-8363) Implementing List with a delegated data source results in StackOverflowException
[ https://issues.apache.org/jira/browse/GROOVY-8363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kevin Chen updated GROOVY-8363: --- Description: Preface: not experienced with submitting bugs to the Groovy project, so please bear with me if anything's unclear. I'm getting a {{StackOverflowException}} from this bit of code (I think just including this snippet demonstrates better than I can explain verbally): {{ class DelegateList { private List lowerCaseStrings = [] private DelegatingListImplementation uppercaseStrings = new DelegatingListImplementation() private abstract static class DelegatingList implements List { abstract List getDelegate() @Override int size() { return delegate.size() } @Override boolean isEmpty() { return delegate.isEmpty() } // etc. } private class DelegatingListImplementation extends DelegatingList { @Override List getDelegate() { return lowerCaseStrings.collect { it.toUpperCase() } } } DelegateList(Collection strings) { lowerCaseStrings = strings.toList().collect { it.toLowerCase() } } List getUppercase() { return uppercaseStrings } public static void main(String[] args) { def d = new DelegateList(['hello', 'bye']) println d.getUppercase() // StackOverflowError } } }} The equivalent doesn't happen in Java. Example repository with both runnables is here: [https://github.com/aspin/groovy-delegate-list]. I'm not really sure how to get deeper into the source of this (Groovy's closure resolving strategies?) and/or how to work around. was: Preface: not experienced with submitting bugs to the Groovy project, so please bear with me if anything's unclear. I'm getting a StackOverflowException from this bit of code (I think just including this snippet demonstrates better than I can explain verbally): {{ class DelegateList { private List lowerCaseStrings = [] private DelegatingListImplementation uppercaseStrings = new DelegatingListImplementation() private abstract static class DelegatingList implements List { abstract List getDelegate() @Override int size() { return delegate.size() } @Override boolean isEmpty() { return delegate.isEmpty() } // etc. } private class DelegatingListImplementation extends DelegatingList { @Override List getDelegate() { return lowerCaseStrings.collect { it.toUpperCase() } } } DelegateList(Collection strings) { lowerCaseStrings = strings.toList().collect { it.toLowerCase() } } List getUppercase() { return uppercaseStrings } public static void main(String[] args) { def d = new DelegateList(['hello', 'bye']) println d.getUppercase() // StackOverflowError } } }} The equivalent doesn't happen in Java. Example repository with both runnables is here: [https://github.com/aspin/groovy-delegate-list]. I'm not really sure how to get deeper into the source of this (Groovy's closure resolving strategies?) and/or how to work around. > Implementing List with a delegated data source results in > StackOverflowException > > > Key: GROOVY-8363 > URL: https://issues.apache.org/jira/browse/GROOVY-8363 > Project: Groovy > Issue Type: Bug >Reporter: Kevin Chen > > Preface: not experienced with submitting bugs to the Groovy project, so > please bear with me if anything's unclear. > I'm getting a {{StackOverflowException}} from this bit of code (I think just > including this snippet demonstrates better than I can explain verbally): > {{ > class DelegateList { > private List lowerCaseStrings = [] > private DelegatingListImplementation uppercaseStrings = new > DelegatingListImplementation() > private abstract static class DelegatingList implements List { > abstract List getDelegate() > @Override > int size() { > return delegate.size() > } > @Override > boolean isEmpty() { > return delegate.isEmpty() > } > // etc. > } > private class DelegatingListImplementation extends DelegatingList { > @Override > List getDelegate() { > return lowerCaseStrings.collect { it.toUpperCase() } > } > } > DelegateList(Collection strings) { > lowerCaseStrings = strings.toList().collect { it.toLowerCase() } > } > List getUppercase() { > return uppercaseStrings > } > public static void main(String[] args) { > def d = new DelegateList(['hello', 'bye']) > println
[jira] [Updated] (GROOVY-8363) Implementing List with a delegated data source results in StackOverflowException
[ https://issues.apache.org/jira/browse/GROOVY-8363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kevin Chen updated GROOVY-8363: --- Description: Preface: not experienced with submitting bugs to the Groovy project, so please bear with me if anything's unclear. I'm getting a StackOverflowException from this bit of code (I think just including this snippet demonstrates better than I can explain verbally): {{ class DelegateList { private List lowerCaseStrings = [] private DelegatingListImplementation uppercaseStrings = new DelegatingListImplementation() private abstract static class DelegatingList implements List { abstract List getDelegate() @Override int size() { return delegate.size() } @Override boolean isEmpty() { return delegate.isEmpty() } // etc. } private class DelegatingListImplementation extends DelegatingList { @Override List getDelegate() { return lowerCaseStrings.collect { it.toUpperCase() } } } DelegateList(Collection strings) { lowerCaseStrings = strings.toList().collect { it.toLowerCase() } } List getUppercase() { return uppercaseStrings } public static void main(String[] args) { def d = new DelegateList(['hello', 'bye']) println d.getUppercase() // StackOverflowError } } }} The equivalent doesn't happen in Java. Example repository with both runnables is here: [https://github.com/aspin/groovy-delegate-list]. I'm not really sure how to get deeper into the source of this (Groovy's closure resolving strategies?) and/or how to work around. was: Preface: not experienced with submitting bugs to the Groovy project, so please bear with me if anything's unclear. I'm getting a StackOverflowException from this bit of code (I think just including this snippet demonstrates better than I can explain verbally): {{ class DelegateList { private List lowerCaseStrings = [] private DelegatingListImplementation uppercaseStrings = new DelegatingListImplementation() private abstract static class DelegatingList implements List { abstract List getDelegate() @Override int size() { return delegate.size() } @Override boolean isEmpty() { return delegate.isEmpty() } // etc. } private class DelegatingListImplementation extends DelegatingList { @Override List getDelegate() { return lowerCaseStrings.collect { it.toUpperCase() } } } DelegateList(Collection strings) { lowerCaseStrings = strings.toList().collect { it.toLowerCase() } } List getUppercase() { return uppercaseStrings } public static void main(String[] args) { def d = new DelegateList(['hello', 'bye']) println d.getUppercase() // StackOverflowError } }}} The equivalent doesn't happen in Java. Example repository with both runnables is here: [https://github.com/aspin/groovy-delegate-list]. I'm not really sure how to get deeper into the source of this (Groovy's closure resolving strategies?) and/or how to work around. > Implementing List with a delegated data source results in > StackOverflowException > > > Key: GROOVY-8363 > URL: https://issues.apache.org/jira/browse/GROOVY-8363 > Project: Groovy > Issue Type: Bug >Reporter: Kevin Chen > > Preface: not experienced with submitting bugs to the Groovy project, so > please bear with me if anything's unclear. > I'm getting a StackOverflowException from this bit of code (I think just > including this snippet demonstrates better than I can explain verbally): > {{ > class DelegateList { > private List lowerCaseStrings = [] > private DelegatingListImplementation uppercaseStrings = new > DelegatingListImplementation() > private abstract static class DelegatingList implements List { > abstract List getDelegate() > @Override > int size() { > return delegate.size() > } > @Override > boolean isEmpty() { > return delegate.isEmpty() > } > // etc. > } > private class DelegatingListImplementation extends DelegatingList { > @Override > List getDelegate() { > return lowerCaseStrings.collect { it.toUpperCase() } > } > } > DelegateList(Collection strings) { > lowerCaseStrings = strings.toList().collect { it.toLowerCase() } > } > List getUppercase() { > return uppercaseStrings > } > public static void main(String[] args) { > def d = new DelegateList(['hello', 'bye']) > println d.getUppercase()
[jira] [Updated] (GROOVY-8363) Implementing List with a delegated data source results in StackOverflowException
[ https://issues.apache.org/jira/browse/GROOVY-8363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kevin Chen updated GROOVY-8363: --- Description: Preface: not experienced with submitting bugs to the Groovy project, so please bear with me if anything's unclear. I'm getting a StackOverflowException from this bit of code (I think just including this snippet demonstrates better than I can explain verbally): {{ class DelegateList { private List lowerCaseStrings = [] private DelegatingListImplementation uppercaseStrings = new DelegatingListImplementation() private abstract static class DelegatingList implements List { abstract List getDelegate() @Override int size() { return delegate.size() } @Override boolean isEmpty() { return delegate.isEmpty() } // etc. } private class DelegatingListImplementation extends DelegatingList { @Override List getDelegate() { return lowerCaseStrings.collect { it.toUpperCase() } } } DelegateList(Collection strings) { lowerCaseStrings = strings.toList().collect { it.toLowerCase() } } List getUppercase() { return uppercaseStrings } public static void main(String[] args) { def d = new DelegateList(['hello', 'bye']) println d.getUppercase() // StackOverflowError } }}} The equivalent doesn't happen in Java. Example repository with both runnables is here: [https://github.com/aspin/groovy-delegate-list]. I'm not really sure how to get deeper into the source of this (Groovy's closure resolving strategies?) and/or how to work around. was: Preface: not experienced with submitting bugs to the Groovy project, so please bear with me if anything's unclear. I'm getting a StackOverflowException from this bit of code (I think just including this snippet demonstrates better than I can explain verbally): {{class DelegateList { private List lowerCaseStrings = [] private DelegatingListImplementation uppercaseStrings = new DelegatingListImplementation() private abstract static class DelegatingList implements List { abstract List getDelegate() @Override int size() { return delegate.size() } @Override boolean isEmpty() { return delegate.isEmpty() } // etc. } private class DelegatingListImplementation extends DelegatingList { @Override List getDelegate() { return lowerCaseStrings.collect { it.toUpperCase() } } } DelegateList(Collection strings) { lowerCaseStrings = strings.toList().collect { it.toLowerCase() } } List getUppercase() { return uppercaseStrings } public static void main(String[] args) { def d = new DelegateList(['hello', 'bye']) println d.getUppercase() // StackOverflowError } }}} The equivalent doesn't happen in Java. Example repository with both runnables is here: [https://github.com/aspin/groovy-delegate-list]. I'm not really sure how to get deeper into the source of this (Groovy's closure resolving strategies?) and/or how to work around. > Implementing List with a delegated data source results in > StackOverflowException > > > Key: GROOVY-8363 > URL: https://issues.apache.org/jira/browse/GROOVY-8363 > Project: Groovy > Issue Type: Bug >Reporter: Kevin Chen > > Preface: not experienced with submitting bugs to the Groovy project, so > please bear with me if anything's unclear. > I'm getting a StackOverflowException from this bit of code (I think just > including this snippet demonstrates better than I can explain verbally): > {{ > class DelegateList { > private List lowerCaseStrings = [] > private DelegatingListImplementation uppercaseStrings = new > DelegatingListImplementation() > private abstract static class DelegatingList implements List { > abstract List getDelegate() > @Override > int size() { > return delegate.size() > } > @Override > boolean isEmpty() { > return delegate.isEmpty() > } > // etc. > } > private class DelegatingListImplementation extends DelegatingList { > @Override > List getDelegate() { > return lowerCaseStrings.collect { it.toUpperCase() } > } > } > DelegateList(Collection strings) { > lowerCaseStrings = strings.toList().collect { it.toLowerCase() } > } > List getUppercase() { > return uppercaseStrings > } > public static void main(String[] args) { > def d = new DelegateList(['hello', 'bye']) > println d.getUppercase() //
[jira] [Updated] (GROOVY-8363) Implementing List with a delegated data source results in StackOverflowException
[ https://issues.apache.org/jira/browse/GROOVY-8363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kevin Chen updated GROOVY-8363: --- Description: Preface: not experienced with submitting bugs to the Groovy project, so please bear with me if anything's unclear. I'm getting a StackOverflowException from this bit of code (I think just including this snippet demonstrates better than I can explain verbally): {{class DelegateList { private List lowerCaseStrings = [] private DelegatingListImplementation uppercaseStrings = new DelegatingListImplementation() private abstract static class DelegatingList implements List { abstract List getDelegate() @Override int size() { return delegate.size() } @Override boolean isEmpty() { return delegate.isEmpty() } // etc. } private class DelegatingListImplementation extends DelegatingList { @Override List getDelegate() { return lowerCaseStrings.collect { it.toUpperCase() } } } DelegateList(Collection strings) { lowerCaseStrings = strings.toList().collect { it.toLowerCase() } } List getUppercase() { return uppercaseStrings } public static void main(String[] args) { def d = new DelegateList(['hello', 'bye']) println d.getUppercase() // StackOverflowError } }}} The equivalent doesn't happen in Java. Example repository with both runnables is here: [https://github.com/aspin/groovy-delegate-list]. I'm not really sure how to get deeper into the source of this (Groovy's closure resolving strategies?) and/or how to work around. was: Preface: not experienced with submitting bugs to the Groovy project, so please bear with me if anything's unclear. I'm getting a `StackOverflowException` from this bit of code (I think just including this snippet demonstrates better than I can explain verbally): ``` class DelegateList { private List lowerCaseStrings = [] private DelegatingListImplementation uppercaseStrings = new DelegatingListImplementation() private abstract static class DelegatingList implements List { abstract List getDelegate() @Override int size() { return delegate.size() } @Override boolean isEmpty() { return delegate.isEmpty() } // etc. } private class DelegatingListImplementation extends DelegatingList { @Override List getDelegate() { return lowerCaseStrings.collect { it.toUpperCase() } } } DelegateList(Collection strings) { lowerCaseStrings = strings.toList().collect { it.toLowerCase() } } List getUppercase() { return uppercaseStrings } public static void main(String[] args) { def d = new DelegateList(['hello', 'bye']) println d.getUppercase() // StackOverflowError } } ``` The equivalent doesn't happen in Java. Example repository with both runnables is here: [https://github.com/aspin/groovy-delegate-list]. I'm not really sure how to get deeper into the source of this (Groovy's closure resolving strategies?) and/or how to work around. > Implementing List with a delegated data source results in > StackOverflowException > > > Key: GROOVY-8363 > URL: https://issues.apache.org/jira/browse/GROOVY-8363 > Project: Groovy > Issue Type: Bug >Reporter: Kevin Chen > > Preface: not experienced with submitting bugs to the Groovy project, so > please bear with me if anything's unclear. > I'm getting a StackOverflowException from this bit of code (I think just > including this snippet demonstrates better than I can explain verbally): > {{class DelegateList { > private List lowerCaseStrings = [] > private DelegatingListImplementation uppercaseStrings = new > DelegatingListImplementation() > private abstract static class DelegatingList implements List { > abstract List getDelegate() > @Override > int size() { > return delegate.size() > } > @Override > boolean isEmpty() { > return delegate.isEmpty() > } > // etc. > } > private class DelegatingListImplementation extends DelegatingList { > @Override > List getDelegate() { > return lowerCaseStrings.collect { it.toUpperCase() } > } > } > DelegateList(Collection strings) { > lowerCaseStrings = strings.toList().collect { it.toLowerCase() } > } > List getUppercase() { > return uppercaseStrings > } > public static void main(String[] args) { > def d = new DelegateList(['hello', 'bye']) > println d.getUppercase()
[jira] [Created] (GROOVY-8363) Implementing List with a delegated data source results in StackOverflowException
Kevin Chen created GROOVY-8363: -- Summary: Implementing List with a delegated data source results in StackOverflowException Key: GROOVY-8363 URL: https://issues.apache.org/jira/browse/GROOVY-8363 Project: Groovy Issue Type: Bug Reporter: Kevin Chen Preface: not experienced with submitting bugs to the Groovy project, so please bear with me if anything's unclear. I'm getting a `StackOverflowException` from this bit of code (I think just including this snippet demonstrates better than I can explain verbally): ``` class DelegateList { private List lowerCaseStrings = [] private DelegatingListImplementation uppercaseStrings = new DelegatingListImplementation() private abstract static class DelegatingList implements List { abstract List getDelegate() @Override int size() { return delegate.size() } @Override boolean isEmpty() { return delegate.isEmpty() } // etc. } private class DelegatingListImplementation extends DelegatingList { @Override List getDelegate() { return lowerCaseStrings.collect { it.toUpperCase() } } } DelegateList(Collection strings) { lowerCaseStrings = strings.toList().collect { it.toLowerCase() } } List getUppercase() { return uppercaseStrings } public static void main(String[] args) { def d = new DelegateList(['hello', 'bye']) println d.getUppercase() // StackOverflowError } } ``` The equivalent doesn't happen in Java. Example repository with both runnables is here: [https://github.com/aspin/groovy-delegate-list]. I'm not really sure how to get deeper into the source of this (Groovy's closure resolving strategies?) and/or how to work around. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Created] (GROOVY-8362) Nested class is resolved via another nested class with package name
Daniil Ovchinnikov created GROOVY-8362: -- Summary: Nested class is resolved via another nested class with package name Key: GROOVY-8362 URL: https://issues.apache.org/jira/browse/GROOVY-8362 Project: Groovy Issue Type: Bug Reporter: Daniil Ovchinnikov Priority: Critical {code:title=bugs/bugs.groovy} package bugs class Current { static class bugs { static class Target {} } static usage() { new Target() // error expected } } println Current.usage() // bugs.Current$bugs$Target@20d28811 {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (GROOVY-8359) Nested class is not resolved if compiled separately
[ https://issues.apache.org/jira/browse/GROOVY-8359?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Daniil Ovchinnikov updated GROOVY-8359: --- Summary: Nested class is not resolved if compiled separately (was: Inner class is not resolved if compiled separately) > Nested class is not resolved if compiled separately > --- > > Key: GROOVY-8359 > URL: https://issues.apache.org/jira/browse/GROOVY-8359 > Project: Groovy > Issue Type: Bug >Reporter: Daniil Ovchinnikov >Priority: Critical > > {code:title=classes.groovy} > package bugs > class CurrentParent { > static class Target {} > } > {code} > {code:title=bug.groovy} > package bugs > class Current extends CurrentParent { > static usage() { > new Target() > } > } > {code} > This works if files are compiled together, but fails if files are compiled > one by one with {{Error:(5, 5) Groovyc: unable to resolve class Target}} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (GROOVY-8361) Nested class is resolved via aliased static import
[ https://issues.apache.org/jira/browse/GROOVY-8361?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Daniil Ovchinnikov updated GROOVY-8361: --- Summary: Nested class is resolved via aliased static import (was: Class is resolved via aliased static import) > Nested class is resolved via aliased static import > -- > > Key: GROOVY-8361 > URL: https://issues.apache.org/jira/browse/GROOVY-8361 > Project: Groovy > Issue Type: Bug >Reporter: Daniil Ovchinnikov >Priority: Critical > > {code:title=unrelatedPackage/Container.groovy} > package unrelatedPackage > class Container { > static class Target {} > } > {code} > {code:title=bugs/bugs.groovy} > package bugs > import static unrelatedPackage.Container.Target as Unrelated > println new Target() // reference is expected to be unresolved > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (GROOVY-8358) Nested class resolution behaves differently depending on class order
[ https://issues.apache.org/jira/browse/GROOVY-8358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Daniil Ovchinnikov updated GROOVY-8358: --- Summary: Nested class resolution behaves differently depending on class order (was: Inner class resolution behaves differently depending on class order) > Nested class resolution behaves differently depending on class order > > > Key: GROOVY-8358 > URL: https://issues.apache.org/jira/browse/GROOVY-8358 > Project: Groovy > Issue Type: Bug >Reporter: Daniil Ovchinnikov >Priority: Critical > > {code} > package bugs > class Outer implements OuterI { > static class Current extends CurrentParent { > static usage() { > new Target() > } > } > } > class CurrentParent implements CurrentParentI {} > interface CurrentParentI { > static class Target {} > } > interface OuterI { > static class Target {} > } > println Outer.Current.usage() // bugs.OuterI$Target@3eb7fc54 > {code} > If {{CurrentParent}} definition is moved before {{Outer}}, then {{new > Target}} will be resolved to {{bugs.CurrentParentI$Target}}: > {code} > package bugs > class CurrentParent implements CurrentParentI {} > class Outer implements OuterI { > class Current extends CurrentParent { > static usage() { > new Target() > } > } > } > interface CurrentParentI { > static class Target {} > } > interface OuterI { > static class Target {} > } > println Outer.Current.usage() // bugs.CurrentParentI$Target@3eb7fc54 > {code} > Moving classes must not affect results of compilation. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (GROOVY-8361) Class is resolved via aliased static import
[ https://issues.apache.org/jira/browse/GROOVY-8361?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Daniil Ovchinnikov updated GROOVY-8361: --- Description: {code:title=unrelatedPackage/Container.groovy} package unrelatedPackage class Container { static class Target {} } {code} {code:title=bugs/bugs.groovy} package bugs import static unrelatedPackage.Container.Target as Unrelated println new Target() // reference is expected to be unresolved {code} was: {code:title=unrelatedPackage/Container.groovy} package unrelatedPackage class Container { static class Target {} } {code} {code:title=bugs/bugs.groovy} package bugs import static unrelatedPackage.Container.Target as Unrelated println new Target() {code} {{Target}} reference is expected to be unresolved > Class is resolved via aliased static import > --- > > Key: GROOVY-8361 > URL: https://issues.apache.org/jira/browse/GROOVY-8361 > Project: Groovy > Issue Type: Bug >Reporter: Daniil Ovchinnikov >Priority: Critical > > {code:title=unrelatedPackage/Container.groovy} > package unrelatedPackage > class Container { > static class Target {} > } > {code} > {code:title=bugs/bugs.groovy} > package bugs > import static unrelatedPackage.Container.Target as Unrelated > println new Target() // reference is expected to be unresolved > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Created] (GROOVY-8361) Class is resolved via aliased static import
Daniil Ovchinnikov created GROOVY-8361: -- Summary: Class is resolved via aliased static import Key: GROOVY-8361 URL: https://issues.apache.org/jira/browse/GROOVY-8361 Project: Groovy Issue Type: Bug Reporter: Daniil Ovchinnikov Priority: Critical {code:title=unrelatedPackage/Container.groovy} package unrelatedPackage class Container { static class Target {} } {code} {code:title=bugs/bugs.groovy} package bugs import static unrelatedPackage.Container.Target as Unrelated println new Target() {code} {{Target}} reference is expected to be unresolved -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GROOVY-8112) NPE in Groovy compiler
[ https://issues.apache.org/jira/browse/GROOVY-8112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16212630#comment-16212630 ] James Kleeh commented on GROOVY-8112: - [~paulk] Just `./gradlew clean classes` > NPE in Groovy compiler > -- > > Key: GROOVY-8112 > URL: https://issues.apache.org/jira/browse/GROOVY-8112 > Project: Groovy > Issue Type: Bug > Components: Compiler >Affects Versions: 2.4.9 > Environment: Windows 8 x64 >Reporter: Alexey Vladykin > > The following Groovy script causes NPE at compile time: > {code:java|title=Bug.groovy} > @Grapes([ > @Grab("org.slf4j:slf4j-api:1.7.22"), > @Grab("org.apache.kafka:kafka-clients:0.10.2.0") > ]) > import groovy.transform.Field > import org.apache.kafka.clients.producer.Callback > import org.apache.kafka.clients.producer.KafkaProducer > import org.apache.kafka.clients.producer.ProducerRecord > import org.apache.kafka.clients.producer.RecordMetadata > import org.slf4j.Logger > import org.slf4j.LoggerFactory > @Field static final Logger logger = LoggerFactory.getLogger(Bug.class) > wrapper { > Properties config = new Properties() > KafkaProducer kafkaProducer = new KafkaProducer<>(config) > kafkaProducer.send(new ProducerRecord<>('topic', 'data'), new Callback() { > @Override > void onCompletion(RecordMetadata recordMetadata, Exception e) { > if (e != null) { > logger.error("Error sending to Kafka", e) > } > } > }) > } > {code} > Full error message from groovyc: > {code:none} > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > General error during class generation: NPE while processing Bug.groovy > groovy.lang.GroovyRuntimeException: NPE while processing Bug.groovy > at > org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:258) > at > org.codehaus.groovy.control.CompilationUnit$16.call(CompilationUnit.java:813) > at > org.codehaus.groovy.control.CompilationUnit$16.call(CompilationUnit.java:830) > at > org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1053) > at > org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591) > at > org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569) > at > org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546) > at > org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:525) > at > org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:61) > at > org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:217) > at > org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:150) > at > org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:180) > at > org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:164) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109) > at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131) > Caused by: java.lang.NullPointerException > at > org.codehaus.groovy.classgen.AsmClassGenerator.visitFieldExpression(AsmClassGenerator.java:1049) > at > org.codehaus.groovy.classgen.asm.ClosureWriter.loadReference(ClosureWriter.java:135) > at > org.codehaus.groovy.classgen.asm.InvocationWriter.loadVariableWithReference(InvocationWriter.java:611) > at > org.codehaus.groovy.classgen.asm.InvocationWriter.writeAICCall(InvocationWriter.java:596) > at > org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeConstructor(InvocationWriter.java:571) > at > org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorCallExpression(AsmClassGenerator.java:818) > at > org.codehaus.groovy.ast.expr.ConstructorCallExpression.visit(ConstructorCallExpression.java:46) > at > org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:303) > at > org.codehaus.groovy.classgen.asm.InvocationWriter.makeCachedCall(InvocationWriter.java:307) > at > org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:392) > at > org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:104) > at >