[jira] [Commented] (GROOVY-8406) DefaultGroovyMethods missing Array support
[ https://issues.apache.org/jira/browse/GROOVY-8406?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16285140#comment-16285140 ] Paul King commented on GROOVY-8406: --- The {{Object}} variants obviously work. Are you really meaning that you'd also like overloaded Array versions to allow additional type inferencing supporting? > DefaultGroovyMethods missing Array support > -- > > Key: GROOVY-8406 > URL: https://issues.apache.org/jira/browse/GROOVY-8406 > Project: Groovy > Issue Type: Improvement >Affects Versions: 2.5.0-beta-1 >Reporter: Nathan Harvey >Priority: Minor > Labels: easyfix > > The methods every, any, and collect support instances of Iterable and > Iterator, but do not include equivalent methods for support arrays. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GROOVY-8406) DefaultGroovyMethods missing Array support
[ https://issues.apache.org/jira/browse/GROOVY-8406?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16285190#comment-16285190 ] Paul King commented on GROOVY-8406: --- If that is the case, here is the complete list of things which I believe are missing. I think we could supply additional {{T[]}} variants for the following {{Object}} variants: {code} any(Closure closure) collect(Closure transform) collect(Collection collector, Closure transform) every(Closure closure) findIndexOf(Closure closure) findIndexOf(int startIndex, Closure closure) findIndexValues(Closure closure) findIndexValues(Number startIndex, Closure closure) findLastIndexOf(Closure closure) findLastIndexOf(int startIndex, Closure closure) findResult(Closure closure) findResult(Object defaultResult, Closure closure) split(Closure closure) {code} In addition, for sum methods taking a closure we currently have {{Iterable}}, {{Iterator}} and {{Object[]}} variants. We could instead have {{Iterable}}, {{Iterator}} and {{T[]}} variants of the following methods: {code} sum(Closure closure) sum(Object initialValue, Closure closure) {code} > DefaultGroovyMethods missing Array support > -- > > Key: GROOVY-8406 > URL: https://issues.apache.org/jira/browse/GROOVY-8406 > Project: Groovy > Issue Type: Improvement >Affects Versions: 2.5.0-beta-1 >Reporter: Nathan Harvey >Priority: Minor > Labels: easyfix > > The methods every, any, and collect support instances of Iterable and > Iterator, but do not include equivalent methods for support arrays. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GROOVY-8406) DefaultGroovyMethods missing Array support
[ https://issues.apache.org/jira/browse/GROOVY-8406?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16285191#comment-16285191 ] Paul King commented on GROOVY-8406: --- Here is a sample test case for three of the methods: {code} @groovy.transform.CompileStatic class Util { static allHiWords(String[] items) { items.collect{ it.toLowerCase() }.every{ it.startsWith('hi') } } static anyBYE(String[] items) { items.any{ it.equalsIgnoreCase('BYE') } } } assert Util.allHiWords(['Hi', 'hiest', 'hippopotamus'] as String[]) assert Util.anyBYE(['Hi', 'bye'] as String[]) {code} > DefaultGroovyMethods missing Array support > -- > > Key: GROOVY-8406 > URL: https://issues.apache.org/jira/browse/GROOVY-8406 > Project: Groovy > Issue Type: Improvement >Affects Versions: 2.5.0-beta-1 >Reporter: Nathan Harvey >Priority: Minor > Labels: easyfix > > The methods every, any, and collect support instances of Iterable and > Iterator, but do not include equivalent methods for support arrays. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Comment Edited] (GROOVY-8406) DefaultGroovyMethods missing Array support
[ https://issues.apache.org/jira/browse/GROOVY-8406?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16285190#comment-16285190 ] Paul King edited comment on GROOVY-8406 at 12/10/17 11:01 AM: -- If that is the case, here is the complete list of things which I believe are missing. I think we could supply additional {{T[]}} variants for the following {{Object}} variants: {code} any(Closure closure) collect(Closure transform) collect(Collection collector, Closure transform) every(Closure closure) findIndexOf(Closure closure) findIndexOf(int startIndex, Closure closure) findIndexValues(Closure closure) findIndexValues(Number startIndex, Closure closure) findLastIndexOf(Closure closure) findLastIndexOf(int startIndex, Closure closure) findResult(Closure closure) findResult(Object defaultResult, Closure closure) split(Closure closure) {code} In addition, for sum methods taking a closure we currently have {{Iterable}}, {{Iterator}} and {{Object[]}} variants. We could instead have {{Iterable}}, {{Iterator}} and {{T[]}} variants of the following methods: {code} sum(Closure closure) sum(Object initialValue, Closure closure) {code} We need to annotate the closure parameter in each case with {{@ClosureParams(FirstParam.Component.class)}}. was (Author: paulk): If that is the case, here is the complete list of things which I believe are missing. I think we could supply additional {{T[]}} variants for the following {{Object}} variants: {code} any(Closure closure) collect(Closure transform) collect(Collection collector, Closure transform) every(Closure closure) findIndexOf(Closure closure) findIndexOf(int startIndex, Closure closure) findIndexValues(Closure closure) findIndexValues(Number startIndex, Closure closure) findLastIndexOf(Closure closure) findLastIndexOf(int startIndex, Closure closure) findResult(Closure closure) findResult(Object defaultResult, Closure closure) split(Closure closure) {code} In addition, for sum methods taking a closure we currently have {{Iterable}}, {{Iterator}} and {{Object[]}} variants. We could instead have {{Iterable}}, {{Iterator}} and {{T[]}} variants of the following methods: {code} sum(Closure closure) sum(Object initialValue, Closure closure) {code} > DefaultGroovyMethods missing Array support > -- > > Key: GROOVY-8406 > URL: https://issues.apache.org/jira/browse/GROOVY-8406 > Project: Groovy > Issue Type: Improvement >Affects Versions: 2.5.0-beta-1 >Reporter: Nathan Harvey >Priority: Minor > Labels: easyfix > > The methods every, any, and collect support instances of Iterable and > Iterator, but do not include equivalent methods for support arrays. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Created] (GROOVY-8410) Provide a common cache
Daniel Sun created GROOVY-8410: -- Summary: Provide a common cache Key: GROOVY-8410 URL: https://issues.apache.org/jira/browse/GROOVY-8410 Project: Groovy Issue Type: Improvement Affects Versions: 2.6.0-alpha-2, 2.4.13, 2.5.0-beta-2, 3.0.0-alpha-1 Reporter: Daniel Sun Assignee: Daniel Sun Fix For: 2.5.0-beta-3, 2.6.0-alpha-3, 3.0.0-alpha-2 There are many cache implementation in Groovy, many of them are duplicated(e.g. cache algorithm, the code of implementation...). That is to say, Groovy is lack of a common cache. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GROOVY-8410) Provide a common cache
[ https://issues.apache.org/jira/browse/GROOVY-8410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16285446#comment-16285446 ] Jochen Theodorou commented on GROOVY-8410: -- could you list what parts you are thinking of here and what kind of caching they use atm? > Provide a common cache > -- > > Key: GROOVY-8410 > URL: https://issues.apache.org/jira/browse/GROOVY-8410 > Project: Groovy > Issue Type: Improvement >Affects Versions: 3.0.0-alpha-1, 2.5.0-beta-2, 2.4.13, 2.6.0-alpha-2 >Reporter: Daniel Sun >Assignee: Daniel Sun > Fix For: 2.5.0-beta-3, 2.6.0-alpha-3, 3.0.0-alpha-2 > > > There are many cache implementation in Groovy, many of them are > duplicated(e.g. cache algorithm, the code of implementation...). That is to > say, Groovy is lack of a common cache. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GROOVY-8410) Provide a common cache
[ https://issues.apache.org/jira/browse/GROOVY-8410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16285480#comment-16285480 ] Daniel Sun commented on GROOVY-8410: Hi Jochen, Here are some caches I found in Groovy codebase: 1. classCache -- refactored https://github.com/apache/groovy/blob/master/src/main/groovy/lang/GroovyClassLoader.java#L98 2. sourceCache -- refactored https://github.com/apache/groovy/blob/master/src/main/groovy/lang/GroovyClassLoader.java#L104 3. MacroMethodsCache -- refactored https://github.com/apache/groovy/blob/master/subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/transform/MacroMethodsCache.java 4. ExtensionMethodCache -- refactored https://github.com/apache/groovy/blob/master/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L2164 5. SimpleCache -- not refactored it(or replace it with a common cache) https://github.com/apache/groovy/blob/master/subprojects/groovy-json/src/main/java/groovy/json/internal/SimpleCache.java > Provide a common cache > -- > > Key: GROOVY-8410 > URL: https://issues.apache.org/jira/browse/GROOVY-8410 > Project: Groovy > Issue Type: Improvement >Affects Versions: 3.0.0-alpha-1, 2.5.0-beta-2, 2.4.13, 2.6.0-alpha-2 >Reporter: Daniel Sun >Assignee: Daniel Sun > Fix For: 2.5.0-beta-3, 2.6.0-alpha-3, 3.0.0-alpha-2 > > > There are many cache implementation in Groovy, many of them are > duplicated(e.g. cache algorithm, the code of implementation...). That is to > say, Groovy is lack of a common cache. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GROOVY-8410) Provide a common cache
[ https://issues.apache.org/jira/browse/GROOVY-8410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16285485#comment-16285485 ] Daniel Sun commented on GROOVY-8410: Here is the implementation of the common cache: https://github.com/apache/groovy/blob/master/src/main/org/codehaus/groovy/runtime/memoize/CommonCache.java > Provide a common cache > -- > > Key: GROOVY-8410 > URL: https://issues.apache.org/jira/browse/GROOVY-8410 > Project: Groovy > Issue Type: Improvement >Affects Versions: 3.0.0-alpha-1, 2.5.0-beta-2, 2.4.13, 2.6.0-alpha-2 >Reporter: Daniel Sun >Assignee: Daniel Sun > Fix For: 2.5.0-beta-3, 2.6.0-alpha-3, 3.0.0-alpha-2 > > > There are many cache implementation in Groovy, many of them are > duplicated(e.g. cache algorithm, the code of implementation...). That is to > say, Groovy is lack of a common cache. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Comment Edited] (GROOVY-8410) Provide a common cache
[ https://issues.apache.org/jira/browse/GROOVY-8410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16285480#comment-16285480 ] Daniel Sun edited comment on GROOVY-8410 at 12/11/17 3:36 AM: -- Hi Jochen, Here are some caches I found in Groovy codebase: 1. classCache -- refactored https://github.com/apache/groovy/blob/master/src/main/groovy/lang/GroovyClassLoader.java#L98 2. sourceCache -- refactored https://github.com/apache/groovy/blob/master/src/main/groovy/lang/GroovyClassLoader.java#L104 3. MacroMethodsCache -- refactored https://github.com/apache/groovy/blob/master/subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/transform/MacroMethodsCache.java 4. ExtensionMethodCache -- refactored https://github.com/apache/groovy/blob/master/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L2164 5. adapterCache -- use LRUCache https://github.com/apache/groovy/blob/master/src/main/groovy/util/ProxyGenerator.java#L75 6. SimpleCache -- not refactored it(or replace it with a common cache) https://github.com/apache/groovy/blob/master/subprojects/groovy-json/src/main/java/groovy/json/internal/SimpleCache.java was (Author: daniel_sun): Hi Jochen, Here are some caches I found in Groovy codebase: 1. classCache -- refactored https://github.com/apache/groovy/blob/master/src/main/groovy/lang/GroovyClassLoader.java#L98 2. sourceCache -- refactored https://github.com/apache/groovy/blob/master/src/main/groovy/lang/GroovyClassLoader.java#L104 3. MacroMethodsCache -- refactored https://github.com/apache/groovy/blob/master/subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/transform/MacroMethodsCache.java 4. ExtensionMethodCache -- refactored https://github.com/apache/groovy/blob/master/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L2164 5. SimpleCache -- not refactored it(or replace it with a common cache) https://github.com/apache/groovy/blob/master/subprojects/groovy-json/src/main/java/groovy/json/internal/SimpleCache.java > Provide a common cache > -- > > Key: GROOVY-8410 > URL: https://issues.apache.org/jira/browse/GROOVY-8410 > Project: Groovy > Issue Type: Improvement >Affects Versions: 3.0.0-alpha-1, 2.5.0-beta-2, 2.4.13, 2.6.0-alpha-2 >Reporter: Daniel Sun >Assignee: Daniel Sun > Fix For: 2.5.0-beta-3, 2.6.0-alpha-3, 3.0.0-alpha-2 > > > There are many cache implementation in Groovy, many of them are > duplicated(e.g. cache algorithm, the code of implementation...). That is to > say, Groovy is lack of a common cache. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Comment Edited] (GROOVY-8410) Provide a common cache
[ https://issues.apache.org/jira/browse/GROOVY-8410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16285480#comment-16285480 ] Daniel Sun edited comment on GROOVY-8410 at 12/11/17 4:26 AM: -- Hi Jochen, Here are some caches I found in Groovy codebase: 1. classCache -- refactored https://github.com/apache/groovy/blob/master/src/main/groovy/lang/GroovyClassLoader.java#L98 2. sourceCache -- refactored https://github.com/apache/groovy/blob/master/src/main/groovy/lang/GroovyClassLoader.java#L104 3. MacroMethodsCache -- refactored https://github.com/apache/groovy/blob/master/subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/transform/MacroMethodsCache.java 4. ExtensionMethodCache -- refactored https://github.com/apache/groovy/blob/master/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L2164 5. adapterCache -- use LRUCache(better performance and no plan to refactor, note: it may cache *same* adapters concurrently because *check and cache* is not atomic) https://github.com/apache/groovy/blob/master/src/main/groovy/util/ProxyGenerator.java#L75 6. SimpleCache -- not refactored (or replaced with a common cache) https://github.com/apache/groovy/blob/master/subprojects/groovy-json/src/main/java/groovy/json/internal/SimpleCache.java was (Author: daniel_sun): Hi Jochen, Here are some caches I found in Groovy codebase: 1. classCache -- refactored https://github.com/apache/groovy/blob/master/src/main/groovy/lang/GroovyClassLoader.java#L98 2. sourceCache -- refactored https://github.com/apache/groovy/blob/master/src/main/groovy/lang/GroovyClassLoader.java#L104 3. MacroMethodsCache -- refactored https://github.com/apache/groovy/blob/master/subprojects/groovy-macro/src/main/groovy/org/codehaus/groovy/macro/transform/MacroMethodsCache.java 4. ExtensionMethodCache -- refactored https://github.com/apache/groovy/blob/master/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L2164 5. adapterCache -- use LRUCache https://github.com/apache/groovy/blob/master/src/main/groovy/util/ProxyGenerator.java#L75 6. SimpleCache -- not refactored it(or replace it with a common cache) https://github.com/apache/groovy/blob/master/subprojects/groovy-json/src/main/java/groovy/json/internal/SimpleCache.java > Provide a common cache > -- > > Key: GROOVY-8410 > URL: https://issues.apache.org/jira/browse/GROOVY-8410 > Project: Groovy > Issue Type: Improvement >Affects Versions: 3.0.0-alpha-1, 2.5.0-beta-2, 2.4.13, 2.6.0-alpha-2 >Reporter: Daniel Sun >Assignee: Daniel Sun > Fix For: 2.5.0-beta-3, 2.6.0-alpha-3, 3.0.0-alpha-2 > > > There are many cache implementation in Groovy, many of them are > duplicated(e.g. cache algorithm, the code of implementation...). That is to > say, Groovy is lack of a common cache. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (GROOVY-8410) Provide a common cache
[ https://issues.apache.org/jira/browse/GROOVY-8410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Daniel Sun updated GROOVY-8410: --- Description: There are many cache implementation in Groovy, many of them are duplicated(e.g. cache algorithm, the code of implementation...). That is to say, Groovy is lack of a common cache. The common cache should be thread safe and achieve basic cache function(keep keys and values, LRU): was:There are many cache implementation in Groovy, many of them are duplicated(e.g. cache algorithm, the code of implementation...). That is to say, Groovy is lack of a common cache. > Provide a common cache > -- > > Key: GROOVY-8410 > URL: https://issues.apache.org/jira/browse/GROOVY-8410 > Project: Groovy > Issue Type: Improvement >Affects Versions: 3.0.0-alpha-1, 2.5.0-beta-2, 2.4.13, 2.6.0-alpha-2 >Reporter: Daniel Sun >Assignee: Daniel Sun > Fix For: 2.5.0-beta-3, 2.6.0-alpha-3, 3.0.0-alpha-2 > > > There are many cache implementation in Groovy, many of them are > duplicated(e.g. cache algorithm, the code of implementation...). That is to > say, Groovy is lack of a common cache. > The common cache should be thread safe and achieve basic cache function(keep > keys and values, LRU): -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (GROOVY-8410) Provide a common cache
[ https://issues.apache.org/jira/browse/GROOVY-8410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Daniel Sun updated GROOVY-8410: --- Description: There are many cache implementation in Groovy, many of them are duplicated(e.g. cache algorithm, the code of implementation...). That is to say, Groovy is lack of a common cache. The common cache should: 1) be thread safe 2) achieve basic cache function(manage keys and values, LRU, etc.) 3) can specify the map that the cache is based on(Maybe we need WeakHashMap sometimes) Here is the implementation of the common cache: https://github.com/apache/groovy/blob/master/src/main/org/codehaus/groovy/runtime/memoize/CommonCache.java was: There are many cache implementation in Groovy, many of them are duplicated(e.g. cache algorithm, the code of implementation...). That is to say, Groovy is lack of a common cache. The common cache should be thread safe and achieve basic cache function(keep keys and values, LRU): > Provide a common cache > -- > > Key: GROOVY-8410 > URL: https://issues.apache.org/jira/browse/GROOVY-8410 > Project: Groovy > Issue Type: Improvement >Affects Versions: 3.0.0-alpha-1, 2.5.0-beta-2, 2.4.13, 2.6.0-alpha-2 >Reporter: Daniel Sun >Assignee: Daniel Sun > Fix For: 2.5.0-beta-3, 2.6.0-alpha-3, 3.0.0-alpha-2 > > > There are many cache implementation in Groovy, many of them are > duplicated(e.g. cache algorithm, the code of implementation...). That is to > say, Groovy is lack of a common cache. > The common cache should: > 1) be thread safe > 2) achieve basic cache function(manage keys and values, LRU, etc.) > 3) can specify the map that the cache is based on(Maybe we need WeakHashMap > sometimes) > Here is the implementation of the common cache: > https://github.com/apache/groovy/blob/master/src/main/org/codehaus/groovy/runtime/memoize/CommonCache.java -- This message was sent by Atlassian JIRA (v6.4.14#64029)