groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <>
Subject Re: Numeric assignment documentation
Date Tue, 25 Aug 2015 06:08:56 GMT
Am 25.08.2015 01:01, schrieb Keegan Witt:
> I ended up putting this in the Java vs Groovy section instead of where I
> originally planned because it occurred to me that these conversions
> apply to more than just assignment (e.g. method invocation).  Here's
> what I have so far:
> Besides wanting any feedback you might have (especially on other options
> for the second table), I also wondered if these behaviors were intentional:
>   * char -> byte requires a cast in Java, but doesn't in Groovy (even
>     with CompileStatic)

the cast is like a security feature in Java, which we don't use in 
normal Groovy. That's why you can for example assign a long to a byte 
too. @compileStatic behaves different in that, but maybe this conversion 
has been forgotten

>   * Most boxing/unboxing works with CompileStatic, but not char ->
>     Character or Character -> char

that looks like a bug to me

>   * Several inconsistencies around when casts are needed when working
>     with CompileStatic (e.g. short -> int and short -> Integer, and char
>     -> int work, but not char -> Integer)

looks like char conversion is missing some aspects. I guess this is also 
due to the analogy of 1-char Strings and Character we use in normal 
Groovy (not supported by @CompileStatic) which did let us forget about 
some transformations

bye blackdrag

Jochen "blackdrag" Theodorou

View raw message