Some of these are known differences with Java.  Some of these are addressed in 
Groovy 5.  And some are open tickets in ASF JIRA: 
https://issues.apache.org/jira/projects/GROOVY/issues?filter=allopenissues&orderby=updated+DESC


It would be best to try each with the latest Groovy 5 snapshot and create a new 
ticket for individual items if you cannot find an existing ticket.

________________________________
From: Saravanan Palanichamy <chava...@gmail.com>
Sent: Saturday, April 5, 2025 11:59 PM
To: us...@groovy.apache.org <us...@groovy.apache.org>; dev@groovy.apache.org 
<dev@groovy.apache.org>
Subject: [EXT] Compiling Java with Groovy

External Email: Use caution with links and attachments.

Hello Groovy users/devs

I am using the Groovy compiler to compile standard Java code (as in the 
developer wrote Java code, I am using the Groovy compiler behind the scenes). 
Most of it works, but I did see a few compatibility issues. Some seem like 
bugs, some seem like parsing differences. Will there be plans to address some 
of them in 5.0 or even 4.0? I am using 4.0.24

1. Interfaces with static methods are not supported
2. Calls to the outer class's super from an inner class does not work.
3. Cannot mix public and private methods with the same name and parameters
4. Groovy incorrectly compiles the accessing of InnerClass's variables when the 
OuterClass has a getter for it
5. Cannot call on outerclass's default method if the inner class extends that 
outerclass
6. Appending of strings with the appending operator on a new line (ie. `+ 
"test"`) would fail in groovy
7. Return with return value on a new line will be considered a return null in 
groovy with a non reacheable
8. Java files will use {} in annotations to define arrays which is not 
supported in groovy where arrays uses square brackets. Static arrays in java 
use {} while groovy uses [].
9, Dollar Signs in Strings need to be escaped in Groovy (Presumably because of 
GString capabilities)
10,. Enums in java switch/case statements must not be fully qualified, but 
enums in groovy case statements must be fully qualified (A fix seems to exist 
but it does not work as expected)
11. Groovy has trouble type inferencing for Collections. The offender is 
Collections.asBlah set of methods. It needs <A.Y.X> to be added explicitly
12. Single Character in Single Quotes are not considered Char
13. Division Operations return a Big Decimal rather than an Integer/Double
14. Functions that take var args will default the type of the first argument, 
java tries to find the common parent type from all arguments

regards
Saravanan

Reply via email to