[jira] [Closed] (GROOVY-8891) Trait Instance Init Block causes Runtime exception for Trait fields with default values
[ https://issues.apache.org/jira/browse/GROOVY-8891?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Anton Pryamostanov closed GROOVY-8891. -- Resolution: Won't Fix This is general semicolon-less Syntax grammar limitation. > Trait Instance Init Block causes Runtime exception for Trait fields with > default values > --- > > Key: GROOVY-8891 > URL: https://issues.apache.org/jira/browse/GROOVY-8891 > Project: Groovy > Issue Type: Bug > Components: Compiler, groovy-runtime >Affects Versions: 2.5.5 >Reporter: Anton Pryamostanov >Priority: Major > > With ref. to GROOVY-8880, when instance or static field has default value in > Trait, when same Trait has Instance Init Block, Runtime exception happens. > Example code: > {code} > trait Trait { > Integer fieldWithDefaultValue = 0 > { > System.out.println("Only instance init block gives this problem") > } > } > class ClassWithTrait implements Trait { > } > new ClassWithTrait().fieldWithDefaultValue > {code} > Runtime exception: > {code} > groovy.lang.MissingMethodException: No signature of method: > java.lang.Integer.call() is applicable for argument types: > (Trait$Trait$Helper$__init__closure1) values: > [Trait$Trait$Helper$__init__closure1@5833d058] > Possible solutions: wait(), abs(), any(), wait(long), > each(groovy.lang.Closure), any(groovy.lang.Closure) > at Trait$Trait$Helper.$init$(ConsoleScript80:3) > at ClassWithTrait.(ConsoleScript80) > at ConsoleScript80.run(ConsoleScript80:9) > {code} > Note: It does not matter if field is static of instance. > Note 2: Static Init Block in Trait does not cause same issue and works Ok. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8888) Strict @NamedParams
[ https://issues.apache.org/jira/browse/GROOVY-?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16691513#comment-16691513 ] Vladimír Oraný commented on GROOVY-: I can't see the "unknown" parameter for "@NamedParams" annotation in the latest snapshot from here: [https://oss.jfrog.org/artifactory/oss-snapshot-local/org/codehaus/groovy/groovy/2.5.5-SNAPSHOT/] or here [https://oss.jfrog.org/artifactory/oss-snapshot-local/org/codehaus/groovy/groovy/2.6.0-SNAPSHOT/] Am I missing something? > Strict @NamedParams > --- > > Key: GROOVY- > URL: https://issues.apache.org/jira/browse/GROOVY- > Project: Groovy > Issue Type: Improvement >Reporter: Vladimír Oraný >Priority: Major > > Thanks, [~paulk] for explaining how does all the "@Named*" annotation works. > I have one suggestion for improvement: > At the moment when you add an extra entry in the map, the static compiler > won't complain. Would be nice to add "strict" property to "@NamedParams" > which will make any additional entry illegal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (GROOVY-8894) Improve performance of DGM `leftShift(OutputStream self, InputStream in)`
Daniel Sun created GROOVY-8894: -- Summary: Improve performance of DGM `leftShift(OutputStream self, InputStream in)` Key: GROOVY-8894 URL: https://issues.apache.org/jira/browse/GROOVY-8894 Project: Groovy Issue Type: Improvement Reporter: Daniel Sun Assignee: Daniel Sun Fix For: 3.0.0-alpha-4, 2.5.5 The original buffer size(1k) is too small. Increase it to 8k. In addition, remove useless code `Thread.yield()` -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (GROOVY-8894) Improve performance of DGM `leftShift(OutputStream, InputStream)`
[ https://issues.apache.org/jira/browse/GROOVY-8894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Daniel Sun updated GROOVY-8894: --- Summary: Improve performance of DGM `leftShift(OutputStream, InputStream)` (was: Improve performance of DGM `leftShift(OutputStream self, InputStream in)`) > Improve performance of DGM `leftShift(OutputStream, InputStream)` > - > > Key: GROOVY-8894 > URL: https://issues.apache.org/jira/browse/GROOVY-8894 > Project: Groovy > Issue Type: Improvement >Reporter: Daniel Sun >Assignee: Daniel Sun >Priority: Major > Fix For: 3.0.0-alpha-4, 2.5.5 > > > The original buffer size(1k) is too small. Increase it to 8k. > In addition, remove useless code `Thread.yield()` -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] groovy pull request #826: GROOVY-8894: Improve performance of DGM `leftShift...
GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/826 GROOVY-8894: Improve performance of DGM `leftShift(OutputStream, Inpu⦠â¦tStream)` You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-io-leftshift Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/826.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #826 commit 43abd7b1dddea45240a53d1848c2aaba001809e4 Author: danielsun1106 Date: 2018-11-19T16:46:21Z GROOVY-8894: Improve performance of DGM `leftShift(OutputStream, InputStream)` ---
[jira] [Commented] (GROOVY-8894) Improve performance of DGM `leftShift(OutputStream, InputStream)`
[ https://issues.apache.org/jira/browse/GROOVY-8894?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16691963#comment-16691963 ] ASF GitHub Bot commented on GROOVY-8894: GitHub user danielsun1106 opened a pull request: https://github.com/apache/groovy/pull/826 GROOVY-8894: Improve performance of DGM `leftShift(OutputStream, Inpu… …tStream)` You can merge this pull request into a Git repository by running: $ git pull https://github.com/danielsun1106/groovy refine-io-leftshift Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/826.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #826 commit 43abd7b1dddea45240a53d1848c2aaba001809e4 Author: danielsun1106 Date: 2018-11-19T16:46:21Z GROOVY-8894: Improve performance of DGM `leftShift(OutputStream, InputStream)` > Improve performance of DGM `leftShift(OutputStream, InputStream)` > - > > Key: GROOVY-8894 > URL: https://issues.apache.org/jira/browse/GROOVY-8894 > Project: Groovy > Issue Type: Improvement >Reporter: Daniel Sun >Assignee: Daniel Sun >Priority: Major > Fix For: 3.0.0-alpha-4, 2.5.5 > > > The original buffer size(1k) is too small. Increase it to 8k. > In addition, remove useless code `Thread.yield()` -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8888) Strict @NamedParams
[ https://issues.apache.org/jira/browse/GROOVY-?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16692282#comment-16692282 ] Paul King commented on GROOVY-: --- I'd expect you'd see it with the 2.5.5 SNAPSHOT if no caching is going on: https://github.com/apache/groovy/blob/GROOVY_2_5_X/src/test/groovy/NamedParameterTest.groovy#L97 It should also be in the latest 3.0.0 snapshot. We aren't going forward with 2.6, so I wouldn't expect to see it there. > Strict @NamedParams > --- > > Key: GROOVY- > URL: https://issues.apache.org/jira/browse/GROOVY- > Project: Groovy > Issue Type: Improvement >Reporter: Vladimír Oraný >Priority: Major > > Thanks, [~paulk] for explaining how does all the "@Named*" annotation works. > I have one suggestion for improvement: > At the moment when you add an extra entry in the map, the static compiler > won't complain. Would be nice to add "strict" property to "@NamedParams" > which will make any additional entry illegal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8889) @NamedParam(required=true) is not enforced
[ https://issues.apache.org/jira/browse/GROOVY-8889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16692370#comment-16692370 ] Paul King commented on GROOVY-8889: --- This is a 2.5.5+ feature. > @NamedParam(required=true) is not enforced > -- > > Key: GROOVY-8889 > URL: https://issues.apache.org/jira/browse/GROOVY-8889 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.4 >Reporter: Vladimír Oraný >Priority: Major > > in following snipped the required parameter is not enforced at all: > {code} > import groovy.transform.CompileStatic > import groovy.transform.NamedParam > import groovy.transform.NamedParams > @CompileStatic > class Tester { > String text > String color > static Tester note(String text, String color) { > return new Tester(text: text, color: color) > } > } > @CompileStatic > class TesterBuilder { > static Tester note( > @NamedParams([ > @NamedParam(value = 'text', type = String, required = > true), > @NamedParam(value = 'color', type = String) > ]) > Map params > ) { > return Tester.note(params.text, params.color) > } > } > @CompileStatic > Tester useBuilder() { > return TesterBuilder.note(color: 'blue') > } > useBuilder() > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Closed] (GROOVY-8849) Provide a way to change property names when converting Pojo to JSON
[ https://issues.apache.org/jira/browse/GROOVY-8849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul King closed GROOVY-8849. - > Provide a way to change property names when converting Pojo to JSON > --- > > Key: GROOVY-8849 > URL: https://issues.apache.org/jira/browse/GROOVY-8849 > Project: Groovy > Issue Type: New Feature > Components: JSON >Affects Versions: 2.5.0 >Reporter: Raviteja Lokineni >Priority: Minor > > I want to be able to override with something like the annotation JsonProperty > to override how a property name should be serialized to Json. If the feature > is already there then please add documentation. For example: > {code:java} > @JsonProperty("test_one") > int testOne > @JsonProperty("test_two") > int testTwo{code} > More information on the example: > [Jackson-Annotations|https://github.com/FasterXML/jackson-annotations/wiki/Jackson-Annotations] > > h1. Reproducible Code > h2. Pojo.groovy > {code:java} > class Pojo { > int testOne > int testTwo > }{code} > h2. Sample Run: > {code:java} > JsonOutput.toJson(new Pojo(testOne: 1, testTwo: 1)) > // Output > // ===> {"testTwo":1,"testOne":1} > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Resolved] (GROOVY-8849) Provide a way to change property names when converting Pojo to JSON
[ https://issues.apache.org/jira/browse/GROOVY-8849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul King resolved GROOVY-8849. --- Resolution: Not A Problem Assuming my suggestions meet your need. Please re-open if that is not the case. > Provide a way to change property names when converting Pojo to JSON > --- > > Key: GROOVY-8849 > URL: https://issues.apache.org/jira/browse/GROOVY-8849 > Project: Groovy > Issue Type: New Feature > Components: JSON >Affects Versions: 2.5.0 >Reporter: Raviteja Lokineni >Priority: Minor > > I want to be able to override with something like the annotation JsonProperty > to override how a property name should be serialized to Json. If the feature > is already there then please add documentation. For example: > {code:java} > @JsonProperty("test_one") > int testOne > @JsonProperty("test_two") > int testTwo{code} > More information on the example: > [Jackson-Annotations|https://github.com/FasterXML/jackson-annotations/wiki/Jackson-Annotations] > > h1. Reproducible Code > h2. Pojo.groovy > {code:java} > class Pojo { > int testOne > int testTwo > }{code} > h2. Sample Run: > {code:java} > JsonOutput.toJson(new Pojo(testOne: 1, testTwo: 1)) > // Output > // ===> {"testTwo":1,"testOne":1} > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Resolved] (GROOVY-8876) groovydoc fails with "java.lang.StringIndexOutOfBoundsException: String index out of range: -1" on file with no extension
[ https://issues.apache.org/jira/browse/GROOVY-8876?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul King resolved GROOVY-8876. --- Resolution: Fixed Assignee: Paul King Fix Version/s: 2.5.5 3.0.0-alpha-4 2.4.16 Should be fixed in the next release. Thanks for spotting the issue. > groovydoc fails with "java.lang.StringIndexOutOfBoundsException: String index > out of range: -1" on file with no extension > - > > Key: GROOVY-8876 > URL: https://issues.apache.org/jira/browse/GROOVY-8876 > Project: Groovy > Issue Type: Bug > Components: GroovyDoc >Affects Versions: 2.4.8 > Environment: $ groovy --version > Groovy Version: 2.4.8 JVM: 1.8.0_181 Vendor: Oracle Corporation OS: Linux >Reporter: Craig Ringer >Assignee: Paul King >Priority: Minor > Fix For: 2.4.16, 3.0.0-alpha-4, 2.5.5 > > > If you invoke {{groovydoc}} on a file with no file extension, such as a > {{Jenkinsfile}} used in Jenkins Pipeline scripts, it fails with > {{java.lang.reflect.InvocationTargetException ... caused by > java.lang.StringIndexOutOfBoundsException: String index out of range: -1}}. > Full exception: > {code} > $ groovydoc Jenkinsfile > java.lang.reflect.InvocationTargetException > 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.StringIndexOutOfBoundsException: String index out of > range: -1 > at java.lang.String.substring(String.java:1967) > at > org.codehaus.groovy.tools.groovydoc.SimpleGroovyClassDocAssembler.(SimpleGroovyClassDocAssembler.java:67) > at > org.codehaus.groovy.tools.groovydoc.GroovyRootDocBuilder.parseGroovy(GroovyRootDocBuilder.java:131) > at > org.codehaus.groovy.tools.groovydoc.GroovyRootDocBuilder.getClassDocsFromSingleSource(GroovyRootDocBuilder.java:83) > at > org.codehaus.groovy.tools.groovydoc.GroovyRootDocBuilder.processFile(GroovyRootDocBuilder.java:213) > at > org.codehaus.groovy.tools.groovydoc.GroovyRootDocBuilder.buildTree(GroovyRootDocBuilder.java:168) > at > org.codehaus.groovy.tools.groovydoc.GroovyDocTool.add(GroovyDocTool.java:82) > at org.codehaus.groovy.tools.groovydoc.GroovyDocTool$add.call(Unknown > Source) > at > org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) > at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) > at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) > at org.codehaus.groovy.tools.groovydoc.Main.execute(Main.groovy:214) > at org.codehaus.groovy.tools.groovydoc.Main.main(Main.groovy:180) > ... 6 more > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] groovy pull request #825: GROOVY-8890: Make "Inspect Tokens" of groovy conso...
Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/825 ---
[jira] [Commented] (GROOVY-8890) Make "Inspect Tokens" of groovy console support Parrot's tokens
[ https://issues.apache.org/jira/browse/GROOVY-8890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16692461#comment-16692461 ] ASF GitHub Bot commented on GROOVY-8890: Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/825 > Make "Inspect Tokens" of groovy console support Parrot's tokens > --- > > Key: GROOVY-8890 > URL: https://issues.apache.org/jira/browse/GROOVY-8890 > Project: Groovy > Issue Type: Improvement > Components: Groovy Console >Reporter: Daniel Sun >Assignee: Daniel Sun >Priority: Major > Fix For: 3.0.0-alpha-4 > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (GROOVY-8895) Traits defining getter conflicts with generated getter
Keegan Witt created GROOVY-8895: --- Summary: Traits defining getter conflicts with generated getter Key: GROOVY-8895 URL: https://issues.apache.org/jira/browse/GROOVY-8895 Project: Groovy Issue Type: Bug Components: Stub generator / Joint compiler Reporter: Keegan Witt {code:java} class Foo { } trait GetFoo { abstract Foo getFoo() } class BaseFooSpec { Foo foo } class FooSpec extends BaseFooSpec implements GetFoo { } {code} Generates a stub for FooSpec with {code:java} public class FooSpec extends BaseFooSpec implements GetFoo,groovy.lang.GroovyObject { ; @groovy.transform.Generated() @groovy.transform.Internal() public groovy.lang.MetaClass getMetaClass() { return (groovy.lang.MetaClass)null;} @groovy.transform.Generated() @groovy.transform.Internal() public void setMetaClass(groovy.lang.MetaClass mc) { } @groovy.transform.Generated() @groovy.transform.Internal() public java.lang.Object invokeMethod(java.lang.String method, java.lang.Object arguments) { return null;} @groovy.transform.Generated() @groovy.transform.Internal() public java.lang.Object getProperty(java.lang.String property) { return null;} @groovy.transform.Generated() @groovy.transform.Internal() public void setProperty(java.lang.String property, java.lang.Object value) { } public abstract Foo getFoo(); } {code} Note the {{getFoo()}} is still {{abstract}} instead of using the getter generated from _BaseFooSpec_. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8892) Trait instance init blocks are called only when there are fields defined in same Trait
[ https://issues.apache.org/jira/browse/GROOVY-8892?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16692795#comment-16692795 ] Anton Pryamostanov commented on GROOVY-8892: Retested OK in 2.5.5.SNAPSHOT > Trait instance init blocks are called only when there are fields defined in > same Trait > -- > > Key: GROOVY-8892 > URL: https://issues.apache.org/jira/browse/GROOVY-8892 > Project: Groovy > Issue Type: Bug > Components: Compiler, groovy-runtime >Affects Versions: 2.5.5 >Reporter: Anton Pryamostanov >Assignee: Paul King >Priority: Major > Fix For: 3.0.0-alpha-4, 2.5.5 > > > With ref. to GROOVY-8880, it seems Instance Init Blocks in Traits are > appended/called only when there are fields defined in the same trait. > Example: > {code} > trait TraitOne { > { > System.out.println("Does not work") > } > } > trait TraitTwo { > Integer instanceCounter //immutable, non-shareable > { > System.out.println("Works") > instanceCounter = 1 > } > } > class ClassWithTrait implements TraitOne, TraitTwo { > } > new ClassWithTrait().instanceCounter > {code} > Output: > {code} > Works > {code} > Expected output (order may differ): > {code} > Works > Does not work > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)