Re: questions about groovysh's doc

2025-07-19 Thread Xeno Amess
question 1 and 2 is cleared. still, I'm uncertain about question 3 3. also another question, I binded several variables, and injected some functions, how can I save the whole context, and load it for use when next time(something like squeak if you know it) Paul King 于2025年7月16日周三 21:57写道: > > >

Re: questions about groovysh's doc

2025-07-19 Thread Xeno Amess
I see the record command, and wonder should I use record to achieve this... still, not found where to load the record into the sh...(I mean by programmably, not like manually open the file then click ctrl+c then ctrl+v and paste to the shell window) Xeno Amess 于2025年7月19日周六 17:40写道: > question 1

Re: questions about groovysh's doc

2025-07-16 Thread Paul King
On Wed, Jul 16, 2025 at 6:07 PM Xeno Amess wrote: > I see > https://github.com/apache/groovy/blob/master/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc > > and still have several questions... > > 1. it said 'Features: No need for *go* command to execute buffer.' > what be the *go* here me

Re: using @GrabConfig(systemClassLoader=true) in a ScriptEngine

2025-07-12 Thread Per Nyfelt
.debug("grabbing [{}] using class loader [{}]",grape_string,classLoader.getClass().getName()) groovy.grape.Grape./grab/(classLoader:classLoader,[[group:group,module:module,version:version]] *as*Map[]) grapes<< grape_string } *catch*(e) { */log/*.error("grab of [{}]

Re: using @GrabConfig(systemClassLoader=true) in a ScriptEngine

2025-07-12 Thread Per Nyfelt
lt; grape_string } *catch*(e) { */log/*.error("grab of [{}] using class loader [{}] failed [{}]",grape_string,classLoader.getClass().getName(),e.message) }     } } *From: *Per Nyfelt *Date: *Friday, July 11, 2025 at 11:54 AM *To: *users@groovy.apache.org *Subject: *[EXT] Re:

Re: Re: using @GrabConfig(systemClassLoader=true) in a ScriptEngine

2025-07-11 Thread Nelson, Erick
grapes << grape_string } catch (e) { log.error("grab of [{}] using class loader [{}] failed [{}]",grape_string,classLoader.getClass().getName(),e.message) } } } From: Per Nyfelt Date: Friday, July 11, 2025 at 11:54 AM To: users@groovy.apache

Re: using @GrabConfig(systemClassLoader=true) in a ScriptEngine

2025-07-11 Thread Per Nyfelt
Thank you for the suggestions! I tried setting the system classloader with -Djava.system.class.loader=org.codehaus.groovy.tools.RootLoader and also tried -Djava.system.class.loader=groovy.lang.GroovyClassloader That indeed fixes the issue with "no suitable classloader available for Grab" but u

Re: Class loaders to use

2025-07-11 Thread Tommy Svensson
> (I think it matters because I may use a different version of jar in the > compiler vs the compiled code) I think this sounds like a bad idea!  Not knowing what you are doing it is hard to tell. I use groovy a lot (compiled, not scripted) and use maven to build and have no problems.  Tomm

Re: using @GrabConfig(systemClassLoader=true) in a ScriptEngine

2025-07-09 Thread Jochen Theodorou
On 08.07.25 12:51, Per Nyfelt wrote: Hi, I am trying to figure out a way to use @GrabConfig(systemClassLoader=true) in a ScritpEngine (or GroovyShell, does not matter. The following script works without any problem using the groovy command (.e.g `groovy sqltaskExample.groovy`): @GrabConfi

Re: Class loaders to use

2025-07-07 Thread Jochen Theodorou
On 07.07.25 02:10, Saravanan Palanichamy wrote: Hello Groovy users I am looking for help in setting up my class loaders with the Groovy compiler. This is my understanding so far 1. The compiler is an external tool to compile (Groovy is a java based compiler) and therefore it must have it

Re: Ginq enhancement?

2025-06-21 Thread Per Nyfelt
Hi Daniel, I tried to expand the Employee object into a org.apache.groovy.ginq.provider.collection.runtime.NamedRecord NamedRecord expand(Object e)  {   new NamedRecord(     [e.mainSsn, e.coSsn, e.firstName, e.salary, e.startDate],     ['mainSsn', 'coSsn', 'firstName', 'salary', 'startDate']  

Re: Ginq enhancement?

2025-06-21 Thread Daniel Sun
Hi Per, GINQ is based on object, but SQL is based on table. We can get metadata for table via database at compile time, but it's hard to get metadata for object by a dynamic language at compile time. Why do we need metadata? Because we use the metadata to process semantic analysis

Re: Ginq enhancement?

2025-06-20 Thread Per Nyfelt
Hi Daniel, I was obviously not phrasing my question well. Let me give it another go: Given two list of objects: import java.time.* class Employee {   String mainSsn   String coSsn   String firstName   BigDecimal salary   LocalDate startDate } class Identifier {   String customerId   String le

Re: Ginq enhancement?

2025-06-20 Thread Daniel Sun
Hi Per, You can find the `leftjoin` usage here: https://github.com/apache/groovy/blob/b046d1b2bcbbddd59ea3d6abdf5de24a671ce51a/subprojects/groovy-ginq/src/spec/test/org/apache/groovy/ginq/GinqTest.groovy#L763 Cheers, Daniel Sun On 2025/06/17 20:46:35 Per Nyfelt wrote: > Hi, > > I ran into a a

Re: Potential to include java.time.* as a default import for Groovy 5

2025-06-10 Thread Paul King
I think the argument is that for small scripts (think replacing shell scripts) and domain classes, @CompileStatic and @CompileDynamic are seldom used, but dates often are. I am overall in favor of making it easier to use those classes. I think we have some more options to explore though with the p

Re: Potential to include java.time.* as a default import for Groovy 5

2025-06-09 Thread Daniel Sun
-0 from me. `@CompileStatic` and `@CompileDynamic` are used more frequently than the classes in the java.time package. Why not add them as well? Cheers, Daniel Sun On 2025/05/31 07:36:51 Paul King wrote: > Hi folks, > > We have a feature request, and potential PR, to add java.time.* as a > n

Re: Errors with using the builder annotation

2025-06-04 Thread Saravanan Palanichamy
Thank you Paul for your response. Yes, but if you change your code to this, I think it will fail. The problem is that we are referencing the type and the resolver cannot find it. So the real question I am trying to answer is how do I add classes in my AST transformation (that I am using in the sou

Re: Errors with using the builder annotation

2025-06-04 Thread Paul King
This seems to work for me: import groovy.transform.builder.Builder @Builder(builderClassName = "MyBuilder") class NoMembers { private int privateInt; public int publicInt; static int staticInt = 1; } class MyOtherClass { public boolean containsValidFieldValues(List expectedFieldV

Re: Errors with using the builder annotation

2025-06-04 Thread Saravanan Palanichamy
I am trying to do something like the Builder annotation, I am adding a new inner class to a class with my custom annotation. It is unclear where I should add it because if I wait to do this in an AST transformation in SEMANTIC_ANALYSIS phase, any use of this type results in an error in the resolve

Re: Potential to include java.time.* as a default import for Groovy 5

2025-06-02 Thread Jochen Theodorou
I have a few points to mention here: (1) we could consider, and that is combined with some danger, to import specific classes only. import foo.bar.X does not have the same problem as import foo.bar.* for the performance of the compiler. The danger of course is that if X is no longer there, it

RE: Potential to include java.time.* as a default import for Groovy 5

2025-06-02 Thread Merlin Beedell
com/r/java/comments/10jfba1/how_to_request_new_java_features_like_import_alias/ Merlin Beedell -Original Message- From: Paul King Sent: 02 June 2025 12:13 To: users@groovy.apache.org Subject: Re: Potential to include java.time.* as a default import for Groovy 5 We aren'

Re: Potential to include java.time.* as a default import for Groovy 5

2025-06-02 Thread Christopher Smith
groovy-starter.conf support (especially for import deletes) would have my strong support. The Tuple imports do work fine; I was using them as another example of collisions with the auto-imported namespaces where I'd like a project-level delete. On Mon, Jun 2, 2025, 06:32 Paul King wrote: > The c

Re: Potential to include java.time.* as a default import for Groovy 5

2025-06-02 Thread Paul King
The current proposal doesn't extend to the format and temporal subpackages. With just the java.time classes and Groovy's datetime extensions, you can go a long way. If you want all the bells and whistles, then you'll need to import some classes/packages. While it is outside the scope of this propo

Re: Potential to include java.time.* as a default import for Groovy 5

2025-06-02 Thread Paul King
This would be the kind of thing that we could support with ImportCustomizer by adding delete functionality. We don't currently support that. Or by allowing default imports to be specified as part of groovy-starter.conf. If we did have a mechanism, it would need to be discoverable from IDEs too. The

Re: Potential to include java.time.* as a default import for Groovy 5

2025-06-02 Thread Paul King
We aren't likely to add "@NoAutoImports or @NoExtendedImports" annotations. The ImportCustomizer is fairly feature rich and is the recommended way to add imports for folks that want them. It doesn't provide a way to remove default imports at present, but it is more likely a place we'd consider enha

Re: Potential to include java.time.* as a default import for Groovy 5

2025-06-02 Thread OCsite
MG, just as for > ... letting people define their own... I might be just missing something of importance or not getting properly what you mean here, but I'd say Groovy already supports defining our own “compound imports” pretty nicely; there are at the very least two ways I know of: - you ca

Re: Potential to include java.time.* as a default import for Groovy 5

2025-06-01 Thread MG
1. I think the idea is, that if the older java.util.Date family of classes gets auto-imported, then its newer counterpart should also be, which makes sense to me. 1. (As I understood it,  java.time.format & java.time.temporal would be auto-imported under the proposal (?)) 2. I do

Re: Potential to include java.time.* as a default import for Groovy 5

2025-06-01 Thread Alexander Veit via users
Am 31.05.25 um 09:36 schrieb Paul King: We have a feature request, and potential PR, to add java.time.* as a new default import: https://issues.apache.org/jira/browse/GROOVY-11513 https://github.com/apache/groovy/pull/2156 I would vote against this proposal. Here are some arguments why: First

Re: Potential to include java.time.* as a default import for Groovy 5

2025-05-31 Thread Remko Popma
+1 On Sun, Jun 1, 2025 at 6:30 AM Gianluca Sartori wrote: > +1 > > Gianluca Sartori > -- > https://dueuno.com > > On Sat, 31 May 2025 at 09:37, Paul King wrote: > > > > Hi folks, > > > > We have a feature request, and potential PR, to add java.time.* as a > > new default import: > > > > https:/

Re: Potential to include java.time.* as a default import for Groovy 5

2025-05-31 Thread Per Nyfelt
+1 Comment: using CompilerConfiguration with a custom ImportCustomizer works but is only applicable to a GroovyShell or GroovyScriptEngine i create myself and @BaseScript is not really transparent. What would be really nice would be to be able to easily adjust default imports in groovy-starte

Re: Potential to include java.time.* as a default import for Groovy 5

2025-05-31 Thread Scott Murphy Heiberg
+1 This issue is really important to be me because I have written *a lot* of short Groovy scripts that do date manipulation. I had to continue using the Date class to avoid imports bogging down the script. There is also a strong need for this for an easy migration of Grails domain classes that

Re: Potential to include java.time.* as a default import for Groovy 5

2025-05-31 Thread Paul King
On Sat, May 31, 2025 at 9:48 PM James Daugherty wrote: > > Hi Paul, > > Is the proposal to do this for 5.x or earlier? 5.0+ > -James > > On Sat, May 31, 2025 at 6:25 AM Sergio del Amo > wrote: >> >> +1 from me. >> >> Although I have fallen into Groovy's @Singleton vs Jakarta @Singleon >> pitf

Re: Potential to include java.time.* as a default import for Groovy 5

2025-05-31 Thread tommy
I'm a big fan of the Groovy language and more default imports are nice. May I suggest a @NoAutoImports or @NoExtendedImports annotation that will disable those for the source files the annotation is in when not wanted due to conflicts ? /Tommy Svensson On 31 May 2025 at 09:43 +0200, Paul King ,

Re: Potential to include java.time.* as a default import for Groovy 5

2025-05-31 Thread Christopher Smith
Would it be feasible to have a project-level configuration akin to lombok.config that could be used to un-auto-import packages (classes would be even better, but I think this conflicts with the internal compiler representation of the auto-imports). I would personally like java.time included, but I

Re: Potential to include java.time.* as a default import for Groovy 5

2025-05-31 Thread Joe Wolf
+1 >From a class-centric perspective, if Date is available by default, LocalDate et. al. should also be available. On Sat, May 31, 2025, 7:48 AM James Daugherty wrote: > Hi Paul, > > Is the proposal to do this for 5.x or earlier? > > -James > > On Sat, May 31, 2025 at 6:25 AM Sergio del Amo >

Re: Potential to include java.time.* as a default import for Groovy 5

2025-05-31 Thread James Daugherty
Hi Paul, Is the proposal to do this for 5.x or earlier? -James On Sat, May 31, 2025 at 6:25 AM Sergio del Amo wrote: > +1 from me. > > Although I have fallen into Groovy's @Singleton vs Jakarta @Singleon > pitfall, given that `java.time` classes are strongly recommended, I think > this change

Re: Potential to include java.time.* as a default import for Groovy 5

2025-05-31 Thread Sergio del Amo
+1 from me. Although I have fallen into Groovy's @Singleton vs Jakarta @Singleon pitfall, given that `java.time` classes are strongly recommended, I think this change is positive. > On 31 May 2025, at 09:36, Paul King wrote: > > Hi folks, > > We have a feature request, and potential PR, to

Re: Potential to include java.time.* as a default import for Groovy 5

2025-05-31 Thread Guillaume Laforge
I'd love to have java.time as a default import! It's interesting you post this today, as just yesterday, I was writing a Groovy script, using java.time, and somehow forgot that it wasn't already a default. Of course, I got an error, and immediately understood that I should have imported the java.ti

Re: Using javaVersion for groovydoc in 4.0.27

2025-05-29 Thread Per Nyfelt
In case someone else want to do this, here's what I did to get the workaround working: 1. Add the dependencies: implementation "org.apache.groovy:groovy:4.0.27" // only needed for groovydoc so limit to compilescope compileOnly "org.apache.groovy:groovy-ant:4.0.27" compileOnly "org.apache.groov

Re: Using javaVersion for groovydoc in 4.0.27

2025-05-29 Thread Per Nyfelt
Great, thanks Paul! The workaround using ant directly in gradle works fine! I created a feature request to support the javaVersion property to the gradle team here https://github.com/gradle/gradle/issues/33659. Best regards, Per On 5/29/25 08:52, Paul King wrote: Yes, Gradle doesn't know ab

Re: Using javaVersion for groovydoc in 4.0.27

2025-05-29 Thread Paul King
Yes, Gradle doesn't know about those 4.0.27 changes yet. Feel free to pester them to add that in an upcoming Gradle release. For now, you can create a custom groovy task, sort of like where Grails is possibly headed: https://github.com/apache/grails-core/blob/groovydoc-tool-rewrite/buildSrc/src/m

Re: Using MarkupBuilder as a closure argument

2025-05-21 Thread Per Nyfelt
Thank you Maarten, delegation strategies looks promising. I'll give it a go. Regards, Per On Wed, 21 May 2025 at 11:18, Maarten Boekhold wrote: > Hi Per, > > Getting back to your original question: have you looked at the closure > delegation strategy? > > https://groovy-lang.org/closures.html#_

Re: Using MarkupBuilder as a closure argument

2025-05-21 Thread tommy
We all have our favorites! :-) Mine is maven. Its structure works very well for me. __ Tommy Svensson to...@natusoft.se On 21 May 2025 at 09:55 +0200, Per Nyfelt , wrote: > Gradle is great and I use it for most of my projects (and I've written some > gradle plugins). However,

Re: Using MarkupBuilder as a closure argument

2025-05-21 Thread Maarten Boekhold
Hi Per, Getting back to your original question: have you looked at the closure delegation strategy? https://groovy-lang.org/closures.html#_delegation_strategy Unless I misunderstood your problem, I think this might help you to 'delegate' property and method access to a MarkupBuilder instance

Re: Using MarkupBuilder as a closure argument

2025-05-21 Thread Per Nyfelt
Gradle is great and I use it for most of my projects (and I've written some gradle plugins). However, Gradle is slowly moving towards a declarative style and I quite like the imperative style of Ant. It's just that AntBuilder is a bit too imperative as a build system. However, when extending it, ad

Re: Using MarkupBuilder as a closure argument

2025-05-20 Thread tommy
Hi again Per, Have you seen Gradle ? I believe that Gradle might provide what you are trying to do. Personally I'm not a Gradle fan, but many are. Tommy Svensson On 20 May 2025 at 10:38 +0200, Per Nyfelt , wrote: > Thanks Tommy, > My problem was in the context of a custom ant task. I found that

Re: Using MarkupBuilder as a closure argument

2025-05-20 Thread Per Nyfelt
Thanks Tommy, My problem was in the context of a custom ant task. I found that if I let go of the idea of "arbitrary additional content" and defined what the different additional sections could be, it was quite easy to do. My solution is here: https://github.com/Alipsa/uso/blob/main/uso-tasks/src/m

Re: Using MarkupBuilder as a closure argument

2025-05-19 Thread tommy
Hello Per, I don't know of anything existing that does what you want. But, in Groovy you can easily define structures like JSON or XML (which both give you a structure but does so using different formats. Example: Map root = [ "id": "QAZ",  "name" : "Nisse", ... ] This is a java.util.Map struc

Re: non-sealed error

2025-05-14 Thread Daniel Sun
Please create a JIRA ticket to track the issue. Cheers, Daniel Sun On 2025/05/10 14:39:44 Mirco Colletta wrote: > Hi Paul, > I've tried with the 5.0.0-alpha12 but unfortunately I get the same error :-( > The ony difference is that the error this time came in a class definition > deeper in the hie

Re: non-sealed error

2025-05-10 Thread Mirco Colletta
Hi Paul, I've tried with the 5.0.0-alpha12 but unfortunately I get the same error :-( The ony difference is that the error this time came in a class definition deeper in the hierarchy: javafx.scene.Node (sealed from jfx24) javafx.scene.Parent (non-sealed from jfx24) javafx.scene.layout.Region Resi

Re: non-sealed error

2025-05-06 Thread Mirco Colletta
Hi Paul, thank you. In the meantime I made a text search for "non-seal" inside the groovy repo and found among the results this interesting flle: https://github.com/apache/groovy/blob/master/src/test/groovy/bugs/Groovy11292.groovy It seems that this test is very similar to my case with the current

Re: non-sealed error

2025-05-06 Thread Paul King
Hi Mirco, I have seen this recently too on JDK24 and thought we had fixed it, but I can't see it tracked explicitly in Jira or in recent commit messages. If you can check against 4.0.27-SNAPSHOT or 5.0.0-SNAPSHOT, that would be great. I'll keep looking in the meantime. Cheers, Paul. On Sun, May

Re: groovysh easily breaks

2025-05-03 Thread MG
Fantastic news, I guess I gotta start using groovysh... Ch;-)eers, mg On 03/05/2025 00:06, OCsite wrote: MG, well we got :D. Also we got :S, :x, and :p — just try :? All the best, OC On 30. 4. 2025, at 17:25, MG wrote: Wait, we have :c - can we also get :o :) :D ... Ch;-)eers, mg On 30/

Re: groovysh easily breaks

2025-05-02 Thread OCsite
MG, well we got :D. Also we got :S, :x, and :p — just try :? All the best, OC > On 30. 4. 2025, at 17:25, MG wrote: > > Wait, we have :c - can we also get :o :) :D ... > > Ch;-)eers, > mg > > On 30/04/2025 14:22, OCsite wrote: >> Well either the following code makes sense, in which case it w

Re: groovysh easily breaks

2025-04-30 Thread MG
Wait, we have :c - can we also get :o :) :D ... Ch;-)eers, mg On 30/04/2025 14:22, OCsite wrote: Well either the following code makes sense, in which case it works, or use :c to cleanup, what's the problem? === 1068 ocs*~/Projects/WO_XC_2018>* /usr/local/groovy-4.0.24/bin/groovysh Groovy Sh

Re: groovysh easily breaks

2025-04-30 Thread Sistemas Jaguar
On Wednesday, April 30th, 2025 at 6:26 AM, Christopher Smith wrote: > The number after the colon indicates that the shell sees unclosed constructs > such as brackets, braces, or parentheses and is waiting for you to close them > before executing. > > I did not know about :c, which is great to

Re: groovysh easily breaks

2025-04-30 Thread Christopher Smith
The number after the colon indicates that the shell sees unclosed constructs such as brackets, braces, or parentheses and is waiting for you to close them before executing. I did not know about :c, which is great to have! On Wed, Apr 30, 2025, 07:06 Sistemas Jaguar wrote: > If an incorrect comm

Re: groovysh easily breaks

2025-04-30 Thread OCsite
Well either the following code makes sense, in which case it works, or use :c to cleanup, what's the problem? === 1068 ocs ~/Projects/WO_XC_2018> /usr/local/groovy-4.0.24/bin/groovysh Groovy Shell (4.0.24, JVM: 11.0.4-BellSoft) Type ':help' or ':h' for help. --

Re: Running ginq from a "clean" classloader

2025-04-29 Thread Per Nyfelt
I figured it out: The GroovyShell belongs to the parent classloader and thus ginq cannot find it when the classloader lacks a parent. One solution is to use the parentless classloader to create the GroovyShell e.g: var c = cl.loadClass("groovy.lang.GroovyShell"); var shell = c.getDeclaredConstr

Re: [ANNOUNCE] GMavenPlus 4.2.0

2025-04-28 Thread Per Nyfelt
Great news, thank you! /Per From: Keegan Witt Reply to: "users@groovy.apache.org" Date: Monday, 28 April 2025 at 04:34 To: GMavenPlus , "users@groovy.apache.org" Subject: [ANNOUNCE] GMavenPlus 4.2.0 GMavenPlus 4.2.0 has been released and should be in Maven Central shortly. Bugs None. Enhan

Re: GC pause by Metadata GC Threshold for weeks then turned to Full GC

2025-04-26 Thread Luis Ashurei
Although it is jruby topic, I will review, thank you! On Sun, Apr 27, 2025 at 2:24 AM Daniel Sun wrote: > I find JRuby had a similar issue: > https://github.com/jruby/jruby/issues/4391 > > Cheers, > Daniel Sun > > On 2025/04/25 05:13:15 Luis Ashurei wrote: > > Hello, > > > > I have a java applic

Re: GC pause by Metadata GC Threshold for weeks then turned to Full GC

2025-04-26 Thread Luis Ashurei
Hi Daniel, I open a JIRA ticket here: https://issues.apache.org/jira/browse/GROOVY-11640 Note that I can't attach script to reproduce the issue, since there are hundreds of them, and I have no idea which is the cause. (I have deeply reviewed the gc with script changes, not find strongly related t

Re: GC pause by Metadata GC Threshold for weeks then turned to Full GC

2025-04-26 Thread Luis Ashurei
Thanks Daniel, I had reviewed all changelog titles between 4.0.8 and 4.0.26, it seems nothing strong related to my issue. It is definitely one of my test options, but I need weeks to push the production environment test. On Sun, Apr 27, 2025 at 2:12 AM

Re: GC pause by Metadata GC Threshold for weeks then turned to Full GC

2025-04-26 Thread Daniel Sun
I find JRuby had a similar issue: https://github.com/jruby/jruby/issues/4391 Cheers, Daniel Sun On 2025/04/25 05:13:15 Luis Ashurei wrote: > Hello, > > I have a java application running heavily groovy scripts. After > running for weeks, the system encountered Full GC in every day, every > time i

Re: GC pause by Metadata GC Threshold for weeks then turned to Full GC

2025-04-26 Thread Daniel Sun
Hi Luis, I find 4.0.8 a bit outdated. Please give Groovy 4.0.26 a try. BTW, could you submit a JIRA ticket and attach a script to reproduce the issue? Cheers, Daniel Sun On 2025/04/25 05:13:15 Luis Ashurei wrote: > Hello, > > I have a java application running heavily groovy scripts. After > ru

Re: Grab and boms

2025-04-22 Thread Per Nyfelt
I removed the .m2 and Grape cache and tried this: #!/usr/bin/env groovy @Grab(group='se.alipsa.matrix', module='matrix-bom', version='2.1.0', type='pom') @Grab('se.alipsa.matrix:matrix-core') def userHome = System.getProperty("user.home") File cacheDir =new File(userHome,".groovy/grapes/se.ali

Re: Error with functions using same name

2025-04-19 Thread Jochen Theodorou
On 19.04.25 12:32, Saravanan Palanichamy wrote: When I define a class in Groovy with 2 methods with the same name, one private and one public, I get this error during static compilation Mixing private and public/protected methods of the same name causes multimethods to be disabled and i

Re: Fwd: IntelliJ 2025.1 has been released with several Grails and Groovy related updates

2025-04-18 Thread MG
Tbh, I would be happy if they finally managed to put out a version which does not have at least one major, annoying bug: 1. Current version we use always does some useless, CPU-maxing-out stuff in the background & (likely because of that) is generally slow / freezes when e.g. searching in

Re: Default for annotation members with type class

2025-04-15 Thread Christopher Smith
The workaround is not to use static compilation for the annotation; it wouldn't do anything anyway. On Tue, Apr 15, 2025, 18:53 Saravanan Palanichamy wrote: > It's under Static compilation. I have raised a ticket for this issue. I am > not sure if there are any work arounds for this issue > > re

Re: Default for annotation members with type class

2025-04-15 Thread Saravanan Palanichamy
It's under Static compilation. I have raised a ticket for this issue. I am not sure if there are any work arounds for this issue regards Saravanan On Tue, Apr 15, 2025 at 6:32 PM Milles, Eric (TR Technology) via dev < d...@groovy.apache.org> wrote: > You should be able to use "default []". I do

Re: Default for annotation members with type class

2025-04-15 Thread Milles, Eric (TR Technology) via users
You should be able to use "default []". I don't think it supports "default new Class[0]". Is this under Static Type Checking or Static Compilation? NOTE: https://issues.apache.org/jira/browse/GROOVY-11492 item 3 covers the missing "default {}" support. From:

Re: putAt and @CompileStatic

2025-04-15 Thread Paul King
A workaround is to cast, e.g. list[1] = (String) null I don't see why that is needed for null. On GROOVY_4_0_X, the map also needs the cast. On master, only the list needs the cast. I can't explain that either (yet). Paul. On Mon, Apr 14, 2025 at 5:37 PM Per Nyfelt wrote: > > Hi, > > I was rec

Re: Default for annotation members with type class

2025-04-15 Thread Paul King
If you define it without static type checking, it is fine to use the square brackets. It is possibly a bug to give those errors when type checking is in play. FYI, there have been previous discussions about supporting the curly brace syntax too. Eric has an issue here: https://issues.apache.org/j

Re: Groovy Markdown 2.2.0 release

2025-04-15 Thread Paul King
Nice! On Fri, Apr 11, 2025 at 6:27 AM Per Nyfelt wrote: > > Hi, > > Maybe this is of interest to people here. > > I just released a new version of gmd (Groovy Markdown) which is a way to > write markdown with executable groovy code snippets very similar to the rmd > package for R and an essenti

Re: putAt and @CompileStatic

2025-04-14 Thread Per Nyfelt
I created https://issues.apache.org/jira/browse/GROOVY-11621 for this. On 2025-04-14, 13:09, "Per Nyfelt" mailto:per.nyf...@nordnet.se>> wrote: Oh, and property assignment with null for maps works with @CompileStatic e.g. def map = [a: 'foo', b: 'bar', c: 'baz'] map.b = null assert map['b'] ==

Re: putAt and @CompileStatic

2025-04-14 Thread Per Nyfelt
Oh, and property assignment with null for maps works with @CompileStatic e.g. def map = [a: 'foo', b: 'bar', c: 'baz'] map.b = null assert map['b'] == null I would assume we want bracket notation and property notation to be functionally equivalent right? On 2025-04-14, 11:37, "Per Nyfelt" mailt

Re: putAt and @CompileStatic

2025-04-14 Thread Per Nyfelt
Thank you for the workaround! For a slightly more complex case of overriding putAt I found that I can do like this if I also provide a getAt which might be of interest for others trying to do similar things: class TwoD { List> rows = [] TwoD(List rows) { this.rows = rows }

Re: Compiling Java with Groovy

2025-04-10 Thread Saravanan Palanichamy
Hi Jochen thank you for your responses. I have attached an example set in my original email, Adding it here again for your reference. Some observations from your comments "foo" +"bar" This is what fails, so I am not sure if I am setting up something incorrectly. It detects + and says StringPlus

Re: Launching a javafx application from a groovy script

2025-04-08 Thread Per Nyfelt
I figured out a workaround: 1. Detect the OS and architecture and set the classifier based on that 2. Use Grape.grab instead of @Grab to download the platform implementation explicitly 3. Use the main method of the Application instead of explicitly calling Application.launch(..) to make the

Re: Trying to write a RAG chunker for Groovy

2025-04-08 Thread Blake McBride
RAG: - You feed blocks of text into an LLM and receive embeddings (numeric vectors) - You store the embeddings and the block of text in a local database that handles vectors - You create a query, send it to the LLM and get the embedding for it. - You feed the embedding of your query into your

Re: Trying to write a RAG chunker for Groovy

2025-04-08 Thread Alessio Stalla
Hi Blake, In my understanding of LLMs, they don't need a parser at all, embeddings work on the text. There are experiments for embedding AST nodes (code2vec, code2seq) but what people usually do is to just treat code as any other piece of text. On Mon, 7 Apr 2025 at 01:49, Blake McBride wrote:

Re: Trying to write a RAG chunker for Groovy

2025-04-08 Thread Daniel Sun
Hi Blake, I think AST transformation can help you. Cheers, Daniel Sun On 2025/04/06 23:49:21 Blake McBride wrote: > Greetings, > > I am trying to write a RAG chunker for Groovy. This is used to (essentially) > train an AI/LLM on my code base so that the AI/LLM can help me with my Groovy

Re: [EXT] Compiling Java with Groovy

2025-04-07 Thread Milles, Eric (TR Technology) via users
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 cre

Re: Compiling Java with Groovy

2025-04-07 Thread Saravanan Palanichamy
which did not compile at all (in my case luckily pretty > small number of those) > 3. incrementally re-write those parts of code which either did not work > properly [*] or just needed an upgrade to pure and nice Groovy, whilst > other parts of the same sources [**] did remain (and a little p

Re: Compiling Java with Groovy

2025-04-07 Thread OCsite
gs which did not compile at all (in my case luckily pretty small number of those) 3. incrementally re-write those parts of code which either did not work properly [*] or just needed an upgrade to pure and nice Groovy, whilst other parts of the same sources [**] did remain (and a little part still rema

Re: Compiling Java with Groovy

2025-04-07 Thread Jochen Theodorou
On 06.04.25 06:59, Saravanan Palanichamy wrote: 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

Re: Minor breaking change of chop(Iterator, int...) method for Groovy 5

2025-04-07 Thread Paul King
I added the PR for the trailing list edge case here: https://github.com/apache/groovy/pull/2180 On Mon, Apr 7, 2025 at 7:12 AM Paul King wrote: > > Actually, there is another edge case with chop that I would also like > to modify since we are making a change anyway. > > Even once the original so

Re: Minor breaking change of chop(Iterator, int...) method for Groovy 5

2025-04-06 Thread Paul King
Actually, there is another edge case with chop that I would also like to modify since we are making a change anyway. Even once the original source of elements is exhausted, we continue "chopping" for each asked for size but give an empty list in such cases. assert ['a', 'b', 'c', 'd', 'e'].chop(1

Re: Modular Groovy application

2025-04-06 Thread Mirco Colletta
Hi Jochen, a quick follow-up: with your suggested modification to the module-info.java file now it works *opens to org.apache.groovy;* Thank you Mirco Il Dom 30 Mar 2025, 22:00 Mirco Colletta ha scritto: > Hi Jochen, > thanks for the observations. > > > It could also be solved by using static

Re: Modular Groovy application

2025-04-05 Thread Mirco Colletta
Hi Jochen, thanks for the observations. > It could also be solved by using static compilation for the module. Actually the app is already statically compiled through a compiler configuration: https://github.com/mcolletta/groovy-modular-example/blob/4f9862d87fedd7a883b358ea0619faa0b5834374/build.g

Re: Minor breaking change of chop(Iterator, int...) method for Groovy 5

2025-04-05 Thread OCsite
Hi there, > On 4. 4. 2025, at 23:09, Mattias Reichel wrote: > I don't see a problem making a breaking change in a major version update. Well it's always somewhat at the inconvenient side for us who maintain a big codebase. On the other hand, when it's easy to find and fix all the places where

Re: New release of the Matrix Library

2025-04-04 Thread Paul King
Looks like a great library. I'll have to try it out. On Wed, Apr 2, 2025, 11:13 PM Per Nyfelt wrote: > Maybe this is of interest to some people here. > > > > I just released a new version of the Matrix library: > https://github.com/Alipsa/matrix. It’s a groovy library for data analysis > / data

Re: Minor breaking change of chop(Iterator, int...) method for Groovy 5

2025-04-04 Thread Mattias Reichel
I don't see a problem making a breaking change in a major version update. Thanks for the thorough explanation! /Mattias Den fre 4 apr. 2025 kl 17:57 skrev Per Nyfelt : > I think the change is good and the right one. Consistency of API will > bring a much better benefit in the long run compared s

Re: Minor breaking change of chop(Iterator, int...) method for Groovy 5

2025-04-04 Thread Per Nyfelt
I think the change is good and the right one. Consistency of API will bring a much better benefit in the long run compared so the initial discomfort to adapt. Regards, Per On 4/4/25 13:41, Paul King wrote: Hi folks, I am seeking feedback on making a breaking change for the DGM chop method (

Re: New release of the Matrix Library

2025-04-03 Thread Daniel Sun
Awesome! On 2025/04/02 12:11:51 Per Nyfelt wrote: > Maybe this is of interest to some people here. > > I just released a new version of the Matrix library: > https://github.com/Alipsa/matrix. It’s a groovy library for data analysis / > data science similar in scope to Tablesaw for java or Panda

Re: Modular Groovy application

2025-03-30 Thread Jochen Theodorou
On 29.03.25 12:18, Mirco Colletta wrote: Hi all, I'd like to know if some of you has experience on how to create a full modular (JPMS, JSR 376) groovy application. > First of all, is it possible, at the moment, to create a full modular groovy application? If yes, what is the recommended approac

Re: safe call evaluates arguments first?

2025-03-29 Thread OCsite
https://issues.apache.org/jira/browse/GROOVY-11591 > On 28. 3. 2025, at 17:26, Jochen Theodorou wrote: > > please add an issue > > On 3/28/25 00:10, OCsite wrote: >> Thanks! >> >> Should I add a jira? Or will you? Or not worth one? >> >> All the best, >> OC >> >>> On 27. 3. 2025, at 21:28, J

Re: safe call evaluates arguments first?

2025-03-28 Thread Jochen Theodorou
please add an issue On 3/28/25 00:10, OCsite wrote: Thanks! Should I add a jira? Or will you? Or not worth one? All the best, OC On 27. 3. 2025, at 21:28, Jochen Theodorou wrote: On 27.03.25 18:11, o...@ocs.cz wrote: Hi there, I've just bumped into this behaviour, as shown e.g., by the c

RE: withIndex for streams

2025-03-28 Thread Merlin Beedell
me.runtime.addShutdownHook (thread) cloj(); Runtime.runtime.removeShutdownHook (thread) } class convertFiles implements Runnable { void run() { try { while (tnefFile = parent.nextF()) { PROCESS FILE.. } Merlin Beedell -Original Message- From: Paul King Sent: 24 March 2025 03:11 To: us

Re: safe call evaluates arguments first?

2025-03-27 Thread OCsite
Thanks! Should I add a jira? Or will you? Or not worth one? All the best, OC > On 27. 3. 2025, at 21:28, Jochen Theodorou wrote: > > On 27.03.25 18:11, o...@ocs.cz wrote: >> Hi there, >> >> I've just bumped into this behaviour, as shown e.g., by the code quoted >> below. A safe method call f

  1   2   3   4   5   6   7   8   9   10   >