Re: Which issue do you MOST want to fix
Hi Daniel, yes, I followed the bug report thank you! Indeed, I would have at least another GroovyCastException case when using @CompileStatic, which however is unrelated to that fix. I can easily reproduce with a project we use internally, which is however tightly bound to our internal services. Today I spent almost two hours to try to isolate the problem in a self-contained test case, but I could not succeed :-( Any idea on what path I may follow to help you further investigate the problem? The code breaks at a point like this: |@CompileStatic|| | |public MyClass {| | // [...]|| | | | | private static Foo createFoo(final String type, final Object value) {| | if(!type || !value) || | | return null;| | def result = new Foo()| | result.with {| | beginUpdate()| | try {| | prop1 = anotherStaticMethodReturningString('blah')| | if(value instanceof String)| | prop2 = anotherStaticMethodReturningString('oh')| | else if (value instanceof BigDecimal)| | prop3 = (BigDecimal) value| | // else if - other cases of instanceof|| | | } finally {| | endUpdate()|| | | }|| | | }| | return result;|| | | }| | | | // [...]|| | |}|| | where: * |Foo| is a Java class coming from a JAR * |beginUpdate()| and |endUpdate()| are methods defined in |Foo| * |prop1|, |prop2| and |prop3| are properties defined in |Foo| (i.e.: there are getters and setters for them) The exception occurs at the invocation of |endUpdate()| with the following exception: |org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'class test.MyClass' with class 'java.lang.Class' to class 'anotherpackage.Foo'|| || at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:414)|| || at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:328)|| || at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:242)|| || at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:615)|| || at test.MyClass$_createFoo_closure6.doCall(MyClass.groovy:295)|| || at test.MyClass$_createFoo_closure6.call(MyClass.groovy)|| || at org.codehaus.groovy.runtime.DefaultGroovyMethods.with(DefaultGroovyMethods.java:369)|| || at org.codehaus.groovy.runtime.DefaultGroovyMethods.with(DefaultGroovyMethods.java:316)|| || at test.MyClass.createFoo(MyClass.groovy:275)| So, it seems like it's trying to invoke |endUpdate()| on |MyClass| class instance rather than on the |Foo| instance to which |with| should delegate to. The problem goes away if either: * I remove |@CompileStatic| (or I just add |@CompileDynamic| to |createFoo()| method)|| * I apply to |MyClass| (or maybe to the consumer code using |MyClass|) a sufficient amount of changes (but I can't say exactly which ones)| | Any idea? Mauro Il 20/02/2019 11:34, Daniel Sun ha scritto: Hi Mauro, The issue you most want to fix is fixed: https://github.com/apache/groovy/commit/f9ebd615cb5d5f766a30b2a6e904084acece Cheers, Daniel.Sun -- Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
Re: Which issue do you MOST want to fix
Hi Mauro, The issue you most want to fix is fixed: https://github.com/apache/groovy/commit/f9ebd615cb5d5f766a30b2a6e904084acece Cheers, Daniel.Sun -- Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
Re: Which issue do you MOST want to fix
Dear community, Regarding important issues to fix in Groovy 3.0, I would raise your attention to the problem that currently Groovy does not allow the overriding of the toString and equals methods for custom collection object i.e. Set, List, Map. I've raised several times this problem in the past and though the community agreed that this is an important limitation, there was not consensus on the solution. Groovy 3.0 could be a good opportunity to have this problem solved. I've opened an issue including a possible solution. https://issues.apache.org/jira/browse/GROOVY-9003 Hope you will take in consideration for the next Groovy major release. Cheers, Paolo On Mon, Feb 18, 2019 at 6:32 AM Basil Peace wrote: > Hi, Daniel! > > Nice to hear that! > Thanks. > > -- > Best regards, > Basil Peace > > > 17.02.2019, 07:08, "Daniel.Sun" : > > Hi Basil, > > > > We plan to re-write Groovydoc from scratch to gain better > maintenance > > and fix all the existing issues. It is targeted to Groovy 3.0.0. > > > > Cheers, > > Daniel.Sun > > > > - > > Apache Groovy committer > > Blog: http://blog.sunlan.me > > Twitter: @daniel_sun > > > > -- > > Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html >
Re: Which issue do you MOST want to fix
Hi, Daniel! Nice to hear that! Thanks. -- Best regards, Basil Peace 17.02.2019, 07:08, "Daniel.Sun" : > Hi Basil, > > We plan to re-write Groovydoc from scratch to gain better maintenance > and fix all the existing issues. It is targeted to Groovy 3.0.0. > > Cheers, > Daniel.Sun > > - > Apache Groovy committer > Blog: http://blog.sunlan.me > Twitter: @daniel_sun > > -- > Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
Re: Which issue do you MOST want to fix
Hi Basil, We plan to re-write Groovydoc from scratch to gain better maintenance and fix all the existing issues. It is targeted to Groovy 3.0.0. Cheers, Daniel.Sun - Apache Groovy committer Blog: http://blog.sunlan.me Twitter: @daniel_sun -- Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
Re: Which issue do you MOST want to fix
Hi! For me, those are the long-existing issues with GroovyDoc. Most wanted are: https://issues.apache.org/jira/browse/GROOVY-4634 - respect @Documented annotation https://issues.apache.org/jira/browse/GROOVY-3782 - support @inheritDoc -- Best regards, Basil Peace 15.02.2019, 21:34, "Daniel.Sun" : > Hi all, > > There are many issues in the JIRA[1], some of them have been fixed > already but not closed yet. You know, reading so many issues one by one is > not efficient way, so I wonder which issue you MOST want to fix(the issue > can be a bug or new feature)? Pls provide us the related JIRA ticket ID, > e.g. GROOVY-8409. > > For me, the issue I most want to fix is GROOVY-8409: Static > compilation with generic function wrapping BiFunction causes > GroovyCastException[2] > > Cheers, > Daniel.Sun > [1] https://issues.apache.org/jira/projects/GROOVY/ > [2] https://issues.apache.org/jira/browse/GROOVY-8409 > > - > Apache Groovy committer > Blog: http://blog.sunlan.me > Twitter: @daniel_sun > > -- > Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
Re: Which issue do you MOST want to fix
Hi Mauro, CliBuilder is refactored with picocli by Remko in Groovy 2.5. I've pinged Remko Popma in the JIRA[1], let's wait for his response ;-) Cheers, Daniel.Sun [1] https://issues.apache.org/jira/browse/GROOVY-8975?focusedCommentId=16770104&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16770104 - Apache Groovy committer Blog: http://blog.sunlan.me Twitter: @daniel_sun -- Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
Re: Which issue do you MOST want to fix
Hi Daniel, my 2-cents. I recently tried Groovy 2.5 for the first time (was on 2.4 before) to write a CLI program and I had a lot of problems with strange exceptions which seem more to be related to Groovy code parsing rather than with compiling or runtime. It was really a hit-and-miss, I had to fill my code with @CompileDynamic methods on @CompileStatic classes to avoid exceptions. This is the bug I opened, because it's easily reproducible by following a published tutorial: GROOVY-8975. It can even be reproduced with dynamic Groovy, but it's easier with static Groovy.. Thanks, Mauro Il 15/02/19 19:31, Daniel.Sun ha scritto: Hi all, There are many issues in the JIRA[1], some of them have been fixed already but not closed yet. You know, reading so many issues one by one is not efficient way, so I wonder which issue you MOST want to fix(the issue can be a bug or new feature)? Pls provide us the related JIRA ticket ID, e.g. GROOVY-8409. For me, the issue I most want to fix is GROOVY-8409: Static compilation with generic function wrapping BiFunction causes GroovyCastException[2] Cheers, Daniel.Sun [1] https://issues.apache.org/jira/projects/GROOVY/ [2] https://issues.apache.org/jira/browse/GROOVY-8409
Which issue do you MOST want to fix
Hi all, There are many issues in the JIRA[1], some of them have been fixed already but not closed yet. You know, reading so many issues one by one is not efficient way, so I wonder which issue you MOST want to fix(the issue can be a bug or new feature)? Pls provide us the related JIRA ticket ID, e.g. GROOVY-8409. For me, the issue I most want to fix is GROOVY-8409: Static compilation with generic function wrapping BiFunction causes GroovyCastException[2] Cheers, Daniel.Sun [1] https://issues.apache.org/jira/projects/GROOVY/ [2] https://issues.apache.org/jira/browse/GROOVY-8409 - Apache Groovy committer Blog: http://blog.sunlan.me Twitter: @daniel_sun -- Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html