[jira] [Created] (GROOVY-8659) Base class has final getter; extending class has property of same name; no warning for final override
Eric Milles created GROOVY-8659: --- Summary: Base class has final getter; extending class has property of same name; no warning for final override Key: GROOVY-8659 URL: https://issues.apache.org/jira/browse/GROOVY-8659 Project: Groovy Issue Type: Question Reporter: Eric Milles Possibly related to GROOVY-8188, this is more of a question than a bug at this point. Should it be an error to have a class extend another with a final method and provide a property of the same name? {code:groovy} class Foo { final Object getProp() {} } class Bar extends Foo { Object prop = 0; // Should this be a similar error? //Object getProp() {} // would be "You are not allowed to override the final method getProp() from class 'Foo'." } {code} Executing {{new Bar().prop}} returns null (from the final method); {{new Bar().@prop}} returns 0. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8657) Resource variable is accessible from finally block
[ https://issues.apache.org/jira/browse/GROOVY-8657?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16519845#comment-16519845 ] Daniel Sun commented on GROOVY-8657: same to local variables of try block, this is an old issue. > Resource variable is accessible from finally block > -- > > Key: GROOVY-8657 > URL: https://issues.apache.org/jira/browse/GROOVY-8657 > Project: Groovy > Issue Type: Bug >Affects Versions: 3.0.0-alpha-2 >Reporter: Daniil Ovchinnikov >Priority: Major > > From http://groovy-lang.org/releasenotes/groovy-3.0.html > {code:groovy} > try( > FromResource from = new FromResource("ARM was here!") > ToResource to = new ToResource() > ) { > to << from > } finally { > assert from.closed // should throw MissingPropertyException > assert to.closed > assert to.toString() == 'ARM was here!' > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8655) Grapes fails to download artifact if POM exists in m2 local, but jar does not
[ https://issues.apache.org/jira/browse/GROOVY-8655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16519605#comment-16519605 ] Mike Robinet commented on GROOVY-8655: -- I have not. > Grapes fails to download artifact if POM exists in m2 local, but jar does not > - > > Key: GROOVY-8655 > URL: https://issues.apache.org/jira/browse/GROOVY-8655 > Project: Groovy > Issue Type: Bug > Components: Grape >Affects Versions: 2.5.0 > Environment: Groovy Version: 2.5.0 JVM: 1.8.0_172 Vendor: Azul > Systems, Inc. OS: Mac OS X >Reporter: Mike Robinet >Priority: Minor > Attachments: grapeError.log > > > > *Steps to reproduce:* > * These instructions use slf4j-api as an example, but it is reproducible > with any artifact. > * Remove local Grapes cache: {{rm -rf ~/.groovy/Grapes}} > * Remove org.slf4j:slf4j-api artifacts from Maven local cache: {{rm -rf > ~/.m2/repository/org/slf4j/slf4j-api}} > * Remove any custom Ivy or Grapes config > * Download POM only for slf4j-api: {{mvn dependency:get > -Dartifact=org.slf4j:slf4j-api:1.7.25:pom -Dtransitive=false}} > * Attempt to install slf4j-api using Grapes: {{grape -V install org.slf4j > slf4j-api 1.7.25}} > *Expected behavior:* > * slf4j-api 1.7.25 jar is downloaded from jcenter > *Actual Behavior:* > * Fails to retrieve jar with NOT FOUND error (verbose log attached): > > {noformat} > :: problems summary :: > WARNINGS > [NOT FOUND ] org.slf4j#slf4j-api;1.7.25!slf4j-api.jar (0ms) > localm2: tried > > file:/Users/Mike/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar > {noformat} > *Workaround:* > * Delete slf4j-api/1.7.25 folder in Maven local and Grapes cache folder and > reinstall. > *Additional notes:* > It is fairly common to only have the POM file for artifacts in your Maven > local. I use the > [gradle-versions-plugin|https://github.com/ben-manes/gradle-versions-plugin] > frequently which is just one example of a tool that downloads only POM files > for artifacts. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (GROOVY-8658) MME on instance receiver via method closure
Daniil Ovchinnikov created GROOVY-8658: -- Summary: MME on instance receiver via method closure Key: GROOVY-8658 URL: https://issues.apache.org/jira/browse/GROOVY-8658 Project: Groovy Issue Type: Bug Affects Versions: 2.5.0 Reporter: Daniil Ovchinnikov {code:groovy} def c = String. c() // IAE: object is not an instance of declaring class c("hi") // MME: No signature of method: java.lang.String.toUpperCase() is applicable for argument types: (java.lang.String) values: [hi] {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (GROOVY-8657) Resource variable is accessible from finally block
Daniil Ovchinnikov created GROOVY-8657: -- Summary: Resource variable is accessible from finally block Key: GROOVY-8657 URL: https://issues.apache.org/jira/browse/GROOVY-8657 Project: Groovy Issue Type: Bug Affects Versions: 3.0.0-alpha-2 Reporter: Daniil Ovchinnikov From http://groovy-lang.org/releasenotes/groovy-3.0.html {code:groovy} try( FromResource from = new FromResource("ARM was here!") ToResource to = new ToResource() ) { to << from } finally { assert from.closed // should throw MissingPropertyException assert to.closed assert to.toString() == 'ARM was here!' } {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Issue Comment Deleted] (GROOVY-8653) foreach index value error
[ https://issues.apache.org/jira/browse/GROOVY-8653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] chenxiaojie updated GROOVY-8653: Comment: was deleted (was: https://issues.apache.org/jira/browse/GROOVY-7409 the reason is similar to this issue. my code is relatively simple, and it is not easy to find this problem.) > foreach index value error > - > > Key: GROOVY-8653 > URL: https://issues.apache.org/jira/browse/GROOVY-8653 > Project: Groovy > Issue Type: Bug > Components: Groovy Console, groovy-jdk >Affects Versions: 2.3.7, 2.4.15 > Environment: jdk1.7.0_79 >Reporter: chenxiaojie >Priority: Major > Original Estimate: 12h > Remaining Estimate: 12h > > {code:java} > import java.util.concurrent.ConcurrentHashMap > import java.util.concurrent.ExecutorService > import java.util.concurrent.Executors > import java.util.concurrent.TimeUnit > import java.util.concurrent.atomic.AtomicInteger > > ConcurrentHashMap map = new > ConcurrentHashMap(1) > ConcurrentHashMap map2 = new > ConcurrentHashMap(1) > ConcurrentHashMap map3 = new > ConcurrentHashMap(1) > ExecutorService es = Executors.newFixedThreadPool(100) > 1.upto(1) { > i -> > es.execute { > AtomicInteger count = map.get(i) > if (count == null) { > count = new AtomicInteger(0) > AtomicInteger oldCount = map.putIfAbsent(i, count) > if (oldCount != null) { > count = oldCount > } > } > count.incrementAndGet() > } > } > for (Integer i = 0; i < 1; i++) { > es.execute { > AtomicInteger count = map2.get(i) > if (count == null) { > count = new AtomicInteger(0) > AtomicInteger oldCount = map2.putIfAbsent(i, count) > if (oldCount != null) { > count = oldCount > } > } > count.incrementAndGet() > } > } > for (Integer i = 0; i < 1; i++) { > Integer j = i > es.execute { > AtomicInteger count = map3.get(j) > if (count == null) { > count = new AtomicInteger(0) > AtomicInteger oldCount = map3.putIfAbsent(j, count) > if (oldCount != null) { > count = oldCount > } > } > count.incrementAndGet() > } > } > es.shutdown() > es.awaitTermination(1, TimeUnit.MINUTES) > // println 1 > println map.size() > // println 6583 ??? size is 0-1 integer > println map2.size() > // println 1 > println map3.size() > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Closed] (GROOVY-8653) foreach index value error
[ https://issues.apache.org/jira/browse/GROOVY-8653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] chenxiaojie closed GROOVY-8653. --- Resolution: Not A Problem https://issues.apache.org/jira/browse/GROOVY-7409 the reason is similar to this issue. my code is relatively simple, and it is not easy to find this problem. > foreach index value error > - > > Key: GROOVY-8653 > URL: https://issues.apache.org/jira/browse/GROOVY-8653 > Project: Groovy > Issue Type: Bug > Components: Groovy Console, groovy-jdk >Affects Versions: 2.3.7, 2.4.15 > Environment: jdk1.7.0_79 >Reporter: chenxiaojie >Priority: Major > Original Estimate: 12h > Remaining Estimate: 12h > > {code:java} > import java.util.concurrent.ConcurrentHashMap > import java.util.concurrent.ExecutorService > import java.util.concurrent.Executors > import java.util.concurrent.TimeUnit > import java.util.concurrent.atomic.AtomicInteger > > ConcurrentHashMap map = new > ConcurrentHashMap(1) > ConcurrentHashMap map2 = new > ConcurrentHashMap(1) > ConcurrentHashMap map3 = new > ConcurrentHashMap(1) > ExecutorService es = Executors.newFixedThreadPool(100) > 1.upto(1) { > i -> > es.execute { > AtomicInteger count = map.get(i) > if (count == null) { > count = new AtomicInteger(0) > AtomicInteger oldCount = map.putIfAbsent(i, count) > if (oldCount != null) { > count = oldCount > } > } > count.incrementAndGet() > } > } > for (Integer i = 0; i < 1; i++) { > es.execute { > AtomicInteger count = map2.get(i) > if (count == null) { > count = new AtomicInteger(0) > AtomicInteger oldCount = map2.putIfAbsent(i, count) > if (oldCount != null) { > count = oldCount > } > } > count.incrementAndGet() > } > } > for (Integer i = 0; i < 1; i++) { > Integer j = i > es.execute { > AtomicInteger count = map3.get(j) > if (count == null) { > count = new AtomicInteger(0) > AtomicInteger oldCount = map3.putIfAbsent(j, count) > if (oldCount != null) { > count = oldCount > } > } > count.incrementAndGet() > } > } > es.shutdown() > es.awaitTermination(1, TimeUnit.MINUTES) > // println 1 > println map.size() > // println 6583 ??? size is 0-1 integer > println map2.size() > // println 1 > println map3.size() > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8653) foreach index value error
[ https://issues.apache.org/jira/browse/GROOVY-8653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16519107#comment-16519107 ] chenxiaojie commented on GROOVY-8653: - https://issues.apache.org/jira/browse/GROOVY-7409 the reason is similar to this issue. my code is relatively simple, and it is not easy to find this problem. > foreach index value error > - > > Key: GROOVY-8653 > URL: https://issues.apache.org/jira/browse/GROOVY-8653 > Project: Groovy > Issue Type: Bug > Components: Groovy Console, groovy-jdk >Affects Versions: 2.3.7, 2.4.15 > Environment: jdk1.7.0_79 >Reporter: chenxiaojie >Priority: Major > Original Estimate: 12h > Remaining Estimate: 12h > > {code:java} > import java.util.concurrent.ConcurrentHashMap > import java.util.concurrent.ExecutorService > import java.util.concurrent.Executors > import java.util.concurrent.TimeUnit > import java.util.concurrent.atomic.AtomicInteger > > ConcurrentHashMap map = new > ConcurrentHashMap(1) > ConcurrentHashMap map2 = new > ConcurrentHashMap(1) > ConcurrentHashMap map3 = new > ConcurrentHashMap(1) > ExecutorService es = Executors.newFixedThreadPool(100) > 1.upto(1) { > i -> > es.execute { > AtomicInteger count = map.get(i) > if (count == null) { > count = new AtomicInteger(0) > AtomicInteger oldCount = map.putIfAbsent(i, count) > if (oldCount != null) { > count = oldCount > } > } > count.incrementAndGet() > } > } > for (Integer i = 0; i < 1; i++) { > es.execute { > AtomicInteger count = map2.get(i) > if (count == null) { > count = new AtomicInteger(0) > AtomicInteger oldCount = map2.putIfAbsent(i, count) > if (oldCount != null) { > count = oldCount > } > } > count.incrementAndGet() > } > } > for (Integer i = 0; i < 1; i++) { > Integer j = i > es.execute { > AtomicInteger count = map3.get(j) > if (count == null) { > count = new AtomicInteger(0) > AtomicInteger oldCount = map3.putIfAbsent(j, count) > if (oldCount != null) { > count = oldCount > } > } > count.incrementAndGet() > } > } > es.shutdown() > es.awaitTermination(1, TimeUnit.MINUTES) > // println 1 > println map.size() > // println 6583 ??? size is 0-1 integer > println map2.size() > // println 1 > println map3.size() > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Resolved] (GROOVY-8627) Compile error using NamedParam with value
[ https://issues.apache.org/jira/browse/GROOVY-8627?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul King resolved GROOVY-8627. --- Resolution: Fixed Assignee: Paul King Fix Version/s: 2.5.1 Proposed PR merged. Thanks for spotting the issue. > Compile error using NamedParam with value > - > > Key: GROOVY-8627 > URL: https://issues.apache.org/jira/browse/GROOVY-8627 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.0 >Reporter: Eric Milles >Assignee: Paul King >Priority: Major > Fix For: 2.5.1 > > > {{NamedVariantASTTransformation}} has bug checking for presence of {{value}} > member. > {code:java} > for (Parameter fromParam : fromParams) { > if (AnnotatedNodeUtils.hasAnnotation(fromParam, > NAMED_PARAM_TYPE)) { > AnnotationNode namedParam = > fromParam.getAnnotations(NAMED_PARAM_TYPE).get(0); > boolean required = memberHasValue(namedParam, "required", > true); > if (getMemberValue(namedParam, "name") == null) { > namedParam.addMember("value", > constX(fromParam.getName())); > } > String name = getMemberStringValue(namedParam, "value"); > {code} > Check here is for {{name}} and if not found, fill in {{value}} from name of > annotated param. There are 2 problems with this: > 1. {{NamedParam}} has no {{name}} member > 2. {{NamedParam}} indicates {{value}} as required (no default value provided > in declaration) > Example that produces error: > {code:groovy} > import groovy.transform.* > @ToString(includeNames=true) > class Color { > Integer r, g, b > } > @NamedVariant > String m(@NamedDelegate Color color, @NamedParam(value='a', required=true) > int alpha) { > return [color, alpha].join(' ') > } > print m(r:1, g:2, b:3, a: 0) > {code} > Compiling this script results in this error because the {{@NamedParam}} > annotation already has a {{value}} member when this line from the transform > is executed: {{namedParam.addMember("value", constX(fromParam.getName()));}}. > {code} > 1. ERROR in Script.groovy (at line 1)\r\n > import groovy.transform.*\r\n > ^\n > Groovy:Groovy compiler error: exception in phase 'semantic analysis' in > source unit 'Script.groovy' Annotation member value has already been added @ > line 1, column 0. > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Resolved] (GROOVY-8637) @NamedVariant processing error
[ https://issues.apache.org/jira/browse/GROOVY-8637?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul King resolved GROOVY-8637. --- Resolution: Fixed Assignee: Paul King Fix Version/s: 2.5.1 Proposed PR merged. Thanks for spotting the issue. > @NamedVariant processing error > -- > > Key: GROOVY-8637 > URL: https://issues.apache.org/jira/browse/GROOVY-8637 > Project: Groovy > Issue Type: Bug > Components: Compiler >Reporter: Alexey Afanasiev >Assignee: Paul King >Priority: Critical > Fix For: 2.5.1 > > > Example about @NamedVariant from > http://groovy-lang.org/releasenotes/groovy-2.5.html works perfectly well as > far as all @NamedDelegate type are compiling in the same compilation unit. > {code:java} > class Animal { > String type, name > } > @ToString(includeNames=true) > class Color { > Integer r, g, b > } > @NamedVariant > String foo(String s1, @NamedParam String s2, >@NamedDelegate Color shade, >@NamedDelegate Animal pet) { > "$s1 $s2 ${pet.type?.toUpperCase()}:$pet.name $shade" > } > {code} > But let's modify this example. If you have Animal an Color classes compiled > beforehand and passed to the compiler with classpath, you will receive 'Error > during @NamedVariant processing. Duplicate property 'metaClass' found.' > NamedVariantASTTransformation treats 'setMetaClass' method as set method of > some property with ''metaClass' name. Obviously these names are clashed at > compile time. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Resolved] (GROOVY-8224) Stubs for classes implementing traits with fields don't include getters/setters
[ https://issues.apache.org/jira/browse/GROOVY-8224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul King resolved GROOVY-8224. --- Resolution: Fixed Assignee: Paul King Fix Version/s: 2.5.1 2.4.16 Proposed PR merged. Thanks to all involved. > Stubs for classes implementing traits with fields don't include > getters/setters > --- > > Key: GROOVY-8224 > URL: https://issues.apache.org/jira/browse/GROOVY-8224 > Project: Groovy > Issue Type: Bug > Components: Stub generator / Joint compiler >Reporter: Keegan Witt >Assignee: Paul King >Priority: Major > Fix For: 2.4.16, 2.5.1 > > > As an example, the stubs generated for _GroovyXImpl_ for the Groovy below > doesn't include {{int getFoo()}} or {{void setFoo(int value)}}. > {code:java} > trait GroovyXTrait { > int foo > } > class GroovyXImpl implements GroovyXTrait { } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8224) Stubs for classes implementing traits with fields don't include getters/setters
[ https://issues.apache.org/jira/browse/GROOVY-8224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16518977#comment-16518977 ] ASF GitHub Bot commented on GROOVY-8224: Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/760 > Stubs for classes implementing traits with fields don't include > getters/setters > --- > > Key: GROOVY-8224 > URL: https://issues.apache.org/jira/browse/GROOVY-8224 > Project: Groovy > Issue Type: Bug > Components: Stub generator / Joint compiler >Reporter: Keegan Witt >Priority: Major > > As an example, the stubs generated for _GroovyXImpl_ for the Groovy below > doesn't include {{int getFoo()}} or {{void setFoo(int value)}}. > {code:java} > trait GroovyXTrait { > int foo > } > class GroovyXImpl implements GroovyXTrait { } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] groovy pull request #760: GROOVY-8224: Stubs for classes implementing traits...
Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/760 ---