paulk_asert
05/18/2025, 11:54 AMjonnybot
05/30/2025, 7:03 PMVampire
06/04/2025, 9:53 AMsize
method to java.util.stream.Stream
?
And is there a reason NioExtensions#eachFile(Path, Closure)
does not have a @ClosureParams
annotation?paulk_asert
06/04/2025, 10:09 AMsize()
as an alias for count()
. It would have the same caveats as count
in terms of side-effects/infinite streams.Vampire
06/04/2025, 10:11 AMpaulk_asert
06/04/2025, 10:16 AMNioExtensions#eachFile(Path, Closure)
, it should have the same closure params as NioExtensions#eachFile(Path, FileType, Closure)
. I presume just an oversight.Vampire
06/04/2025, 10:36 AMFile
is the argument. ๐คทโโ๏ธ
https://youtrack.jetbrains.com/issue/IDEA-373956paulk_asert
06/04/2025, 10:38 AMpaulk_asert
06/04/2025, 10:42 AMpaulk_asert
06/04/2025, 10:43 AMVampire
06/04/2025, 11:44 AMpaulk_asert
06/04/2025, 1:37 PMVampire
06/04/2025, 1:48 PMpaulk_asert
06/04/2025, 1:50 PMbsdooby
06/13/2025, 6:59 AMbsdooby
06/13/2025, 7:00 AMpaulk_asert
06/13/2025, 8:22 AMbsdooby
06/13/2025, 8:32 AMrecord Vector2d(float x, float y) { }
bsdooby
06/13/2025, 8:32 AMbsdooby
06/13/2025, 8:33 AMbsdooby
06/13/2025, 8:33 AMpaulk_asert
06/13/2025, 8:41 AMpaulk_asert
06/13/2025, 8:54 AMbsdooby
06/13/2025, 9:48 AMjonnybot
06/16/2025, 9:50 PMcfValues['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:
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?paulk_asert
06/16/2025, 10:12 PMjonnybot
06/16/2025, 10:17 PMMariano
06/24/2025, 10:06 PMimplementation '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:
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!bobby0204
06/26/2025, 10:57 AMVampire
06/27/2025, 1:01 PMprintln(/\u21a/) // 1
println(/\u21aX/) // 2
println(/\u21aF/) // 3
println('\u21a') // 4
println('\u21aX') // 5
println('\u21aF') // 6
the result is
1 - a backslash followed by 4 characters
2 - a backslash followed by 5 characters
3 - the "Downwards Zigzag Arrow" character
4 - compile error complaining about the first single-quote as unexpected character
5 - compile error complaining about the first single-quote as unexpected character
6 - the "Downwards Zigzag Arrow" character
?
For Java the Unicode escapes are evaluated and replaced before the actual source code parser kicks in and it complains about incomplete or wrong Unicode escapes, complaining about the second single-quote in code according to 2 / 4, and about the X in code according to 3 / 5, even if it is found in code comments.
In Java you could for example also use void foo\u0058bar()
to declare a method called fooXbar
due to Unicode escapes being resolved and replaced before the parser kicks in, while in Groovy this does not work as it is handled as part of the parser.
I mainly ask about 1 and 2 as I'm going to report an IntelliJ IDEA issue as the IDE complains about illegal escape sequence which is a false-positive in that case.
And if 1 and 2 is intended, then I tend to question 3, as the backslash does not loose its meaning within the slash-y String in that case.