[jira] [Created] (GROOVY-8920) Fails to infer parameter and return type of SAM on RHS
Daniel Sun created GROOVY-8920: -- Summary: Fails to infer parameter and return type of SAM on RHS Key: GROOVY-8920 URL: https://issues.apache.org/jira/browse/GROOVY-8920 Project: Groovy Issue Type: Bug Reporter: Daniel Sun Assignee: Daniel Sun Currently: {code:java} If the parameter type and return type of lambda are not specified, STC does not work. Function f = (Integer e) -> (Integer) (e + 1) {code} After fixed: {code:java} Function f = e -> e + 1 {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Closed] (GROOVY-8916) JsonOutput unable to serialize Locale object
[ https://issues.apache.org/jira/browse/GROOVY-8916?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sébastien Gadot closed GROOVY-8916. --- Update to 2.5 and use JsonGenerator > JsonOutput unable to serialize Locale object > > > Key: GROOVY-8916 > URL: https://issues.apache.org/jira/browse/GROOVY-8916 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime >Affects Versions: 2.4.15 >Reporter: Sébastien Gadot >Priority: Minor > Fix For: 2.5.x > > > Trying to serialize an object containing a Locale throws > StackOverflowException > example : > > > {code:java} > JsonOutput.toJson([loc: Locale.FRANCE]) > // expected {"loc": "fr_FR"} > // got StackOverflowException > {code} > {code:java} > java.lang.StackOverflowError > at > java.lang.reflect.InvocationTargetException.(InvocationTargetException.java:72) > at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98) > at groovy.lang.MetaBeanProperty.getProperty(MetaBeanProperty.java:59) > at groovy.lang.PropertyValue.getValue(PropertyValue.java:42) > at > org.codehaus.groovy.runtime.DefaultGroovyMethods.getProperties(DefaultGroovyMethods.java:474) > at groovy.json.JsonOutput.getObjectProperties(JsonOutput.java:338) > at groovy.json.JsonOutput.writeObject(JsonOutput.java:331) > at groovy.json.JsonOutput.writeMap(JsonOutput.java:469) > at groovy.json.JsonOutput.writeObject(JsonOutput.java:332) > at groovy.json.JsonOutput.writeMap(JsonOutput.java:469) > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Resolved] (GROOVY-8916) JsonOutput unable to serialize Locale object
[ https://issues.apache.org/jira/browse/GROOVY-8916?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sébastien Gadot resolved GROOVY-8916. - Resolution: Fixed Fix Version/s: 2.5.x The workaround is OK by me. I will do it this way, thanks -> Upgrade to 2.5 and use JsonGenerator. > JsonOutput unable to serialize Locale object > > > Key: GROOVY-8916 > URL: https://issues.apache.org/jira/browse/GROOVY-8916 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime >Affects Versions: 2.4.15 >Reporter: Sébastien Gadot >Priority: Minor > Fix For: 2.5.x > > > Trying to serialize an object containing a Locale throws > StackOverflowException > example : > > > {code:java} > JsonOutput.toJson([loc: Locale.FRANCE]) > // expected {"loc": "fr_FR"} > // got StackOverflowException > {code} > {code:java} > java.lang.StackOverflowError > at > java.lang.reflect.InvocationTargetException.(InvocationTargetException.java:72) > at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98) > at groovy.lang.MetaBeanProperty.getProperty(MetaBeanProperty.java:59) > at groovy.lang.PropertyValue.getValue(PropertyValue.java:42) > at > org.codehaus.groovy.runtime.DefaultGroovyMethods.getProperties(DefaultGroovyMethods.java:474) > at groovy.json.JsonOutput.getObjectProperties(JsonOutput.java:338) > at groovy.json.JsonOutput.writeObject(JsonOutput.java:331) > at groovy.json.JsonOutput.writeMap(JsonOutput.java:469) > at groovy.json.JsonOutput.writeObject(JsonOutput.java:332) > at groovy.json.JsonOutput.writeMap(JsonOutput.java:469) > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (GROOVY-8916) JsonOutput unable to serialize Locale object
[ https://issues.apache.org/jira/browse/GROOVY-8916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16718505#comment-16718505 ] Paul King edited comment on GROOVY-8916 at 12/12/18 6:22 AM: - One of the properties of the Locale class is the "default" Locale. Hence, that object serializes into (your details may vary slightly): {code} {"loc":{"script":"","ISO3Country":"FRA","localeExtensions":null,"ISO3Language":"fra","displayCountry":"France", "default":{"script":"","ISO3Country":"AUS","localeExtensions":null,"ISO3Language":"eng","displayCountry":"Australia", "default":{"script":"","ISO3Country":"AUS","localeExtensions":null,"ISO3Language": ... {code} Rather than trying to handle cases like this, in Groovy 2.5 we added the ability to customize JSON generation. You can look at the 2.5 release notes or view this blog here: http://mrhaki.blogspot.com/2018/06/groovy-goodness-customizing-json-output.html In your case you can do: {code} import groovy.json.* def generator = new JsonGenerator.Options() .addConverter(Locale) { Locale loc -> loc.toString() } .build() println generator.toJson([loc: Locale.FRANCE]) // => {"loc":"fr_FR"} {code} was (Author: paulk): One of the properties of the Locale class is the "default" Locale. Hence, that object serializes into: {code} {"loc":{"script":"","ISO3Country":"FRA","localeExtensions":null,"ISO3Language":"fra","displayCountry":"France", "default":{"script":"","ISO3Country":"AUS","localeExtensions":null,"ISO3Language":"eng","displayCountry":"Australia", "default":{"script":"","ISO3Country":"AUS","localeExtensions":null,"ISO3Language": ... {code} Rather than trying to handle cases like this, in Groovy 2.5 we added the ability to customize JSON generation. You can look at the 2.5 release notes or view this blog here: http://mrhaki.blogspot.com/2018/06/groovy-goodness-customizing-json-output.html In your case you can do: {code} import groovy.json.* def generator = new JsonGenerator.Options() .addConverter(Locale) { Locale loc -> loc.toString() } .build() println generator.toJson([loc: Locale.FRANCE]) // => {"loc":"fr_FR"} {code} > JsonOutput unable to serialize Locale object > > > Key: GROOVY-8916 > URL: https://issues.apache.org/jira/browse/GROOVY-8916 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime >Affects Versions: 2.4.15 >Reporter: Sébastien Gadot >Priority: Minor > > Trying to serialize an object containing a Locale throws > StackOverflowException > example : > > > {code:java} > JsonOutput.toJson([loc: Locale.FRANCE]) > // expected {"loc": "fr_FR"} > // got StackOverflowException > {code} > {code:java} > java.lang.StackOverflowError > at > java.lang.reflect.InvocationTargetException.(InvocationTargetException.java:72) > at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98) > at groovy.lang.MetaBeanProperty.getProperty(MetaBeanProperty.java:59) > at groovy.lang.PropertyValue.getValue(PropertyValue.java:42) > at > org.codehaus.groovy.runtime.DefaultGroovyMethods.getProperties(DefaultGroovyMethods.java:474) > at groovy.json.JsonOutput.getObjectProperties(JsonOutput.java:338) > at groovy.json.JsonOutput.writeObject(JsonOutput.java:331) > at groovy.json.JsonOutput.writeMap(JsonOutput.java:469) > at groovy.json.JsonOutput.writeObject(JsonOutput.java:332) > at groovy.json.JsonOutput.writeMap(JsonOutput.java:469) > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8916) JsonOutput unable to serialize Locale object
[ https://issues.apache.org/jira/browse/GROOVY-8916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16718505#comment-16718505 ] Paul King commented on GROOVY-8916: --- One of the properties of the Locale class is the "default" Locale. Hence, that object serializes into: {code} {"loc":{"script":"","ISO3Country":"FRA","localeExtensions":null,"ISO3Language":"fra","displayCountry":"France", "default":{"script":"","ISO3Country":"AUS","localeExtensions":null,"ISO3Language":"eng","displayCountry":"Australia", "default":{"script":"","ISO3Country":"AUS","localeExtensions":null,"ISO3Language": ... {code} Rather than trying to handle cases like this, in Groovy 2.5 we added the ability to customize JSON generation. You can look at the 2.5 release notes or view this blog here: http://mrhaki.blogspot.com/2018/06/groovy-goodness-customizing-json-output.html In your case you can do: {code} import groovy.json.* def generator = new JsonGenerator.Options() .addConverter(Locale) { Locale loc -> loc.toString() } .build() println generator.toJson([loc: Locale.FRANCE]) // => {"loc":"fr_FR"} {code} > JsonOutput unable to serialize Locale object > > > Key: GROOVY-8916 > URL: https://issues.apache.org/jira/browse/GROOVY-8916 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime >Affects Versions: 2.4.15 >Reporter: Sébastien Gadot >Priority: Minor > > Trying to serialize an object containing a Locale throws > StackOverflowException > example : > > > {code:java} > JsonOutput.toJson([loc: Locale.FRANCE]) > // expected {"loc": "fr_FR"} > // got StackOverflowException > {code} > {code:java} > java.lang.StackOverflowError > at > java.lang.reflect.InvocationTargetException.(InvocationTargetException.java:72) > at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98) > at groovy.lang.MetaBeanProperty.getProperty(MetaBeanProperty.java:59) > at groovy.lang.PropertyValue.getValue(PropertyValue.java:42) > at > org.codehaus.groovy.runtime.DefaultGroovyMethods.getProperties(DefaultGroovyMethods.java:474) > at groovy.json.JsonOutput.getObjectProperties(JsonOutput.java:338) > at groovy.json.JsonOutput.writeObject(JsonOutput.java:331) > at groovy.json.JsonOutput.writeMap(JsonOutput.java:469) > at groovy.json.JsonOutput.writeObject(JsonOutput.java:332) > at groovy.json.JsonOutput.writeMap(JsonOutput.java:469) > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Closed] (GROOVY-8919) publish artifacts for Groovy 2.4.16 to Maven central repo
[ https://issues.apache.org/jira/browse/GROOVY-8919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul King closed GROOVY-8919. - Resolution: Not A Problem 2.4.16 hasn't been released yet. It is currently undergoing voting and due to finish today. If voting is successful (looks very likely but -1 votes are still possible), the artifacts will be released on maven central as part of the normal release process. > publish artifacts for Groovy 2.4.16 to Maven central repo > - > > Key: GROOVY-8919 > URL: https://issues.apache.org/jira/browse/GROOVY-8919 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.4.16 >Reporter: Ian Springer >Priority: Major > > Please publish artifacts for Groovy 2.4.16 to the Maven central repo. > > Thanks! > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (GROOVY-8919) publish artifacts for Groovy 2.4.16 to Maven central repo
Ian Springer created GROOVY-8919: Summary: publish artifacts for Groovy 2.4.16 to Maven central repo Key: GROOVY-8919 URL: https://issues.apache.org/jira/browse/GROOVY-8919 Project: Groovy Issue Type: Bug Affects Versions: 2.4.16 Reporter: Ian Springer Please publish artifacts for Groovy 2.4.16 to the Maven central repo. Thanks! -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-8917) Failed to infer parameter type of some SAM, e.g. BinaryOperator
[ https://issues.apache.org/jira/browse/GROOVY-8917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16717384#comment-16717384 ] ASF GitHub Bot commented on GROOVY-8917: Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/837 > Failed to infer parameter type of some SAM, e.g. BinaryOperator > --- > > Key: GROOVY-8917 > URL: https://issues.apache.org/jira/browse/GROOVY-8917 > Project: Groovy > Issue Type: Bug >Reporter: Daniel Sun >Assignee: Daniel Sun >Priority: Major > > {code:java} > import groovy.transform.CompileStatic > import java.util.stream.Collectors > import java.util.stream.Stream > > @CompileStatic > public class Test1 { > public static void main(String[] args) { > p(); > } > > public static void p() { > // If we do not explicitly declare the type of parameter, STC > fails > assert 13 == [1, 2, 3].stream().reduce(7, (Integer r, Integer > e) -> r + e); > } > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Resolved] (GROOVY-8917) Failed to infer parameter type of some SAM, e.g. BinaryOperator
[ https://issues.apache.org/jira/browse/GROOVY-8917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Daniel Sun resolved GROOVY-8917. Resolution: Fixed Fix Version/s: 3.0.0-alpha-4 Fixed by https://github.com/apache/groovy/commit/1bd305bfb2b6b3d5ed02947f0117470a6e43c5fe > Failed to infer parameter type of some SAM, e.g. BinaryOperator > --- > > Key: GROOVY-8917 > URL: https://issues.apache.org/jira/browse/GROOVY-8917 > Project: Groovy > Issue Type: Bug >Reporter: Daniel Sun >Assignee: Daniel Sun >Priority: Major > Fix For: 3.0.0-alpha-4 > > > {code:java} > import groovy.transform.CompileStatic > import java.util.stream.Collectors > import java.util.stream.Stream > > @CompileStatic > public class Test1 { > public static void main(String[] args) { > p(); > } > > public static void p() { > // If we do not explicitly declare the type of parameter, STC > fails > assert 13 == [1, 2, 3].stream().reduce(7, (Integer r, Integer > e) -> r + e); > } > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] groovy pull request #837: GROOVY-8917: Failed to infer parameter type of som...
Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/837 ---