Re: Differences with Java

2024-11-02 Thread Saravanan Palanichamy
My Customers write Java code, I use Groovy's awesome AST transforms to update it. I want to understand how to handle the differences from Java a) Handle the newline in return usecase, both compile errors and unexpected behaviour (I could write an AST transform to check for this, but it feels more

Re: Differences with Java

2024-11-02 Thread Saravanan Palanichamy
I realize that I am trying to do something different, compile Java using Groovy. I wonder if supporting this will open up a lot more usage of Groovy (especially when doing AST transformations), which is exactly what I am trying to do Greedy is a solution, I think another way would be to use ; as a

Re: Differences with Java

2024-11-02 Thread Christopher Smith
I suggest that the Groovy parser should be "greedier" in both of the return cases you showed. Furthermore, as this is a trap that's bitten me before, I propose that it should be a compile-time error to use a bare "return" statement in a method with a non-void return type; implied "return null" is a

Differences with Java

2024-11-02 Thread Saravanan Palanichamy
Hello there I am compiling standard Java code with Groovy (it works for the most part with some exceptions) and want to call out some differences. Is there a way for me to auto fix these discrepancies with say a text pre-processor or some AST parsing modifications? *Compile errors with new lines.