https://groovy-lang.org/ logo
Join Slack
Powered by
# groovy
  • p

    paulk_asert

    05/18/2025, 10:41 AM
    As per my response on the mailing list, I don't think we normally call that task, but if you exclude any failing tasks, e.g. "-x groovy-cli-picocli:checkstyleMainReport" I think it should work okay.
    ๐Ÿ™Œ 1
  • p

    paulk_asert

    05/18/2025, 10:44 AM
    Actually, I don't think that task is defined, so it's just a false positive for the bad-practices gradle check.
  • p

    paulk_asert

    05/18/2025, 11:54 AM
    Can you pull and retry
    โœ… 1
  • j

    jonnybot

    05/30/2025, 7:03 PM
    So, I'm trying to tweak the Groovy compiler so that, for a specific set of methods on a specific class, I can override the return type. I started with a Type Checking Extension, and that isn't quite working as I'd expect. I'm thinking an AST Transform in the SEMANTIC_ANALYSIS phase might be more suitable. I'll post some more details in a thread, but any pointers would be appreciated.
    • 1
    • 4
  • v

    Vampire

    06/04/2025, 9:53 AM
    Is there a reason GDK does not add a
    size
    method to
    java.util.stream.Stream
    ? And is there a reason
    NioExtensions#eachFile(Path, Closure)
    does not have a
    @ClosureParams
    annotation?
  • p

    paulk_asert

    06/04/2025, 10:09 AM
    It should probably have
    size()
    as an alias for
    count()
    . It would have the same caveats as
    count
    in terms of side-effects/infinite streams.
  • v

    Vampire

    06/04/2025, 10:11 AM
    That's what I did expect, yeah
  • p

    paulk_asert

    06/04/2025, 10:16 AM
    For
    NioExtensions#eachFile(Path, Closure)
    , it should have the same closure params as
    NioExtensions#eachFile(Path, FileType, Closure)
    . I presume just an oversight.
  • v

    Vampire

    06/04/2025, 10:36 AM
    Thought so. It might also be the cause that IJ thinks a
    File
    is the argument. ๐Ÿคทโ€โ™‚๏ธ https://youtrack.jetbrains.com/issue/IDEA-373956
  • p

    paulk_asert

    06/04/2025, 10:38 AM
    What is the type hint if you add the FileType param?
  • p

    paulk_asert

    06/04/2025, 10:42 AM
    Yeah, just tried it and it is Path with a FileType added.
  • p

    paulk_asert

    06/04/2025, 10:43 AM
    Were you keen to create issues/PRs or happy if I do that?
  • v

    Vampire

    06/04/2025, 11:44 AM
    I'm fine with you fixing the two issues right away, thx. :-)
  • p

    paulk_asert

    06/04/2025, 1:37 PM
    https://issues.apache.org/jira/browse/GROOVY-11691
    ๐Ÿ‘Œ 1
  • v

    Vampire

    06/04/2025, 1:48 PM
    Do you also take care of the Stream.size? ๐Ÿ™‚
  • p

    paulk_asert

    06/04/2025, 1:50 PM
    https://github.com/apache/groovy/pull/2247
    โค๏ธ 1
  • b

    bsdooby

    06/13/2025, 6:59 AM
    In the newest Eclipse 2025-06, I get the following error in a Groovy script where a (Java native) Record type is declared:
  • b

    bsdooby

    06/13/2025, 7:00 AM
    Using Java 22; this worked before. What did change w.r.t. Java, Groovy?
  • p

    paulk_asert

    06/13/2025, 8:22 AM
    Do you explicitly subclass and it worked before? Or is this error complaining about something under the covers?
  • b

    bsdooby

    06/13/2025, 8:32 AM
    I did not subclass it; I just use(d) the following at toplevel
    record Vector2d(float x, float y) { }
  • b

    bsdooby

    06/13/2025, 8:32 AM
    This worked before
  • b

    bsdooby

    06/13/2025, 8:33 AM
    But I guess it is more on the Eclipse (IDE) side of things?
  • b

    bsdooby

    06/13/2025, 8:33 AM
    (as almost always ๐Ÿ˜ž )
  • p

    paulk_asert

    06/13/2025, 8:41 AM
    Maybe create an issue anyway and Eric might have further thoughts. I don't think he frequents slack much (if at all). And we can close if we definitely believe it's on the Eclipse side of things.
    b
    • 2
    • 2
  • p

    paulk_asert

    06/13/2025, 8:54 AM
    Or send to the dev mailing list
  • b

    bsdooby

    06/13/2025, 9:48 AM
    OK, thx Paul
  • j

    jonnybot

    06/16/2025, 9:50 PM
    I'm trying to debug an issue with the static type checker and closure method parameters. It seems like in Groovy 4.0.19, something changed that has broken type checking for statements like:
    Copy code
    cfValues['SpecialKey']*.name.collect {it.toUpperCase()}
    Some context:
    cfValues
    is a binding variable that I provide custom type information for via a
    ClassCodeExpressionTransformer
    . In this case, the static type checker seems to know that
    cfValues['SpecialKey']
    returns a value of the expected type which, in turn, has a
    name
    property that is a String. Statements like:
    Copy code
    cfValues['SpecialKey']*.name*.toUpperCase()
    compiles just fine. But from Groovy 4.0.19 onward, the static type checker only seems to think that the
    it
    Closure parameter is an
    Object
    , not a
    String
    . I've been poring over the diff and stepping through the debugger to figure out what changed, but I haven't been able to fathom it out. Does this ring a bell for anyone?
  • p

    paulk_asert

    06/16/2025, 10:12 PM
    Jonny, do you want to send your last query to the mailing list. I could try to dive into what might have changed but Eric might know off the top of his head. He doesn't visit slack much, if at all.
    ๐Ÿ‘ 1
    thankyou 1
  • j

    jonnybot

    06/16/2025, 10:17 PM
    Sure, Paul! dev@groovy.apache.org?
    ๐Ÿ‘ 1
  • m

    Mariano

    06/24/2025, 10:06 PM
    Hi! I'm having an issue with a NPE on a class using @CompileStatic, when using StringBuilder with null Integer/Long values. Tested with Gradle 8.13, using:
    implementation 'org.apache.groovy:groovy:4.0.27'
    Also happens with Groovy 3.x, which is where I hit the issue (it's a Grails app). Short example code:
    Copy code
    import groovy.transform.CompileStatic
    
    @CompileStatic
    class SomeClass {
    
        String desc
        Integer int1
        Long long1
    
        @Override
        String toString() {
            return new StringBuilder('SomeClass{')
                    .append('desc=').append(desc)
                    .append(', int1=').append(int1)
                    .append(', long1=').append(long1)
                    .append('}')
                    .toString()
        }
    
    }
    
    static void main(String[] args) {
        println new SomeClass(desc: 'desc', int1: 1, long1: 2).toString() // works
        println new SomeClass().toString() // causes NPE with @CompileStatic
    }
    Should I report this on JIRA? Though I don't have access to it and I'm short on time right now. Thanks!