Re: Class file version problem on Java 17

2021-11-29 Thread Daniel Sun
Please submit a JIRA ticket to track the issue[1], and it's better to provide 
us a standalone runnable script to reproduce the issue.

Cheers,
Daniel Sun

[1] https://issues.apache.org/jira/projects/GROOVY/summary

On 2021/11/28 19:07:47 Jochen Wiedmann wrote:
> Hi,
> 
> I've got a Groovy script (4.0.0-beta-2), which is embedded into a Java
> program. When unit testing the program on Java 8, everything is
> working fine. However, if I do run the same unit test on Java 17, I
> get the stack trace below.
> 
> Is there anything, I need to adjust when using Java 17? I am thinking
> along the line of setting a target version in the GroovyShell, or the
> like.
> 
> Thanks,
> 
> Jochen
> 
> BUG! exception in phase 'semantic analysis' in source unit
> 'file:/C:/Windows/System32/config/systemprofile/AppData/Local/Jenkins/.jenkins/workspace/afw-17/afw-core/target/test-classes/com/github/jochenw/afw/core/scripts/simple-script.groovy'
> Unsupported class file major version 61
> at 
> org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:905)
> at 
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:627)
> at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:367)
> at 
> groovy.lang.GroovyClassLoader.lambda$parseClass$2(GroovyClassLoader.java:310)
> at 
> org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
> at 
> org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
> at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:308)
> at groovy.lang.GroovyShell.parseClass(GroovyShell.java:526)
> at groovy.lang.GroovyShell.parse(GroovyShell.java:538)
> at groovy.lang.GroovyShell.parse(GroovyShell.java:518)
> 
> 
> 
> -- 
> Philosophy is useless, theology is worse. (Industrial Desease, Dire Straits)
> 


Re: Groovy code generation from AST

2021-10-24 Thread Daniel Sun
FYI.

https://github.com/apache/groovy/blob/master/subprojects/groovy-console/src/main/groovy/groovy/console/ui/AstNodeToScriptAdapter.groovy

https://github.com/apache/groovy/blob/master/subprojects/groovy-console/src/test/groovy/groovy/console/ui/AstNodeToScriptAdapterTest.groovy


Cheers,
Daniel Sun

On 2021/10/22 15:02:16, Max Lynch  wrote: 
> I'm building a tool for making modifications against Groovy/Gradle files.
> I've successfully built an AST using AstBuilder, but I'm not sure how to
> generate Groovy code from the modified AST I have.
> 
> I found the AstNodeToScriptAdapter.groovy which seems like what I'm after
> but it seems specialized and I'm wondering how accurate it is.
> 
> Is there any other class I'm missing for serializing an AST back to source?
> 
> Thanks,
> Max
> 


Re: Groovy with JDK 16

2021-06-19 Thread Daniel Sun
JDK16 should be supported fully if the PR is accepted:
https://github.com/apache/groovy/pull/1598

Cheers,
Daniel Sun

On 2021/06/15 02:35:18, Daniel Sun  wrote: 
> Hi Graeme,
> 
> > is there an issue report to track this or should I file one?
> 
> The issue reports were created, and I've already fixed the dynamic proxy 
> related issues in the PR[1].
> https://issues.apache.org/jira/browse/GROOVY-10137
> https://issues.apache.org/jira/browse/GROOVY-10138
> 
> Other issues were found when running on JDK16 too, see 
> http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
> 
> P.S. sorry for the late reply. I'm too busy recently to look into issues...
> 
> 
> [1] https://github.com/apache/groovy/pull/1598
> 
> Cheers,
> Daniel Sun
> On 2021/05/01 18:53:19, Graeme Rocher  wrote: 
> > Thanks Daniel, is there an issue report to track this or should I file one?
> > 
> > On Sun, Apr 25, 2021 at 4:30 PM Daniel Sun  wrote:
> > 
> > > Hi Graeme,
> > >
> > > > Caused by: java.lang.IllegalAccessException: module jdk.proxy3 does not
> > > open jdk.proxy3 to unnamed module @71559e7c
> > >
> > > At a fast glance, "jdk.proxy3" is a dynamic module[1], "Calling
> > > Constructor.newInstance(Object...) on a proxy class in a dynamic module
> > > will throw IllegalAccessException; Proxy.newProxyInstance method should be
> > > used instead". It seem that something goes wrong when Groovy tries to
> > > create proxy for SAM[2]
> > >
> > > [1]
> > > https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/reflect/Proxy.html#dynamicmodule
> > > [2]
> > > https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/reflection/stdclasses/CachedSAMClass.java#L69-L91
> > >
> > > Cheers,
> > > Daniel Sun
> > > On 2021/04/22 12:24:39, Graeme Rocher  wrote:
> > > > Hi all,
> > > >
> > > > We are close to getting Micronaut's JDK 16 builds passing however some
> > > > tests are failing that are related to Groovy and Spock that I am unsure
> > > how
> > > > to fix.
> > > >
> > > > Most of the errors are like:
> > > >
> > > > java.lang.reflect.InvocationTargetException
> > > > at org.codehaus.groovy.vmplugin.v9.Java9.of(Java9.java:160)
> > > > at
> > > >
> > > org.codehaus.groovy.vmplugin.v9.Java9.getInvokeSpecialHandle(Java9.java:179)
> > > > at
> > > >
> > > java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
> > > > at io.micronaut.core.io.WritableSpec.test flush is
> > > > called(WritableSpec.groovy:13)
> > > > Caused by: java.lang.IllegalAccessException: module jdk.proxy3 does not
> > > > open jdk.proxy3 to unnamed module @71559e7c
> > > > at
> > > >
> > > java.base/java.lang.invoke.MethodHandles.privateLookupIn(MethodHandles.java:260)
> > > > ... 4 more
> > > >
> > > > Which seems to be related to the creation of proxies for closures as the
> > > > code in question that fails looks like:
> > > >
> > > > @Get(value = "/welcome", produces = MediaType.TEXT_PLAIN)
> > > > Writable render() { // <2>
> > > > { writer ->
> > > > template.make( // <3>
> > > > firstName: "Fred",
> > > > lastName: "Flintstone"
> > > > ).writeTo(writer)
> > > > }
> > > > }
> > > >
> > > > There is a single other failure with this Spock error message:
> > > >
> > > > Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make
> > > > field static final java.lang.invoke.MethodHandles$Lookup
> > > > java.lang.invoke.MethodHandles$Lookup.IMPL_LOOKUP accessible: module
> > > > java.base does not "opens java.lang.invoke" to unnamed module @533e0c7
> > > > at
> > > >
> > > org.spockframework.mock.runtime.DefaultMethodInvoker.respond(DefaultMethodInvoker.java:50)
> > > > ... 27 more
> > > >
> > > >
> > > > Are these problems something that has been resolved or being looked at? 
> > > > I
> > > > haven't seen anything with a brief look through the issue tracker.
> > > >
> > > > Thanks for the feedback
> > > > --
> > > > Graeme Rocher
> > > >
> > >
> > 
> > 
> > -- 
> > Graeme Rocher
> > 
> 


Re: Groovy with JDK 16

2021-06-14 Thread Daniel Sun
Hi Graeme,

> is there an issue report to track this or should I file one?

The issue reports were created, and I've already fixed the dynamic proxy 
related issues in the PR[1].
https://issues.apache.org/jira/browse/GROOVY-10137
https://issues.apache.org/jira/browse/GROOVY-10138

Other issues were found when running on JDK16 too, see 
http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

P.S. sorry for the late reply. I'm too busy recently to look into issues...


[1] https://github.com/apache/groovy/pull/1598

Cheers,
Daniel Sun
On 2021/05/01 18:53:19, Graeme Rocher  wrote: 
> Thanks Daniel, is there an issue report to track this or should I file one?
> 
> On Sun, Apr 25, 2021 at 4:30 PM Daniel Sun  wrote:
> 
> > Hi Graeme,
> >
> > > Caused by: java.lang.IllegalAccessException: module jdk.proxy3 does not
> > open jdk.proxy3 to unnamed module @71559e7c
> >
> > At a fast glance, "jdk.proxy3" is a dynamic module[1], "Calling
> > Constructor.newInstance(Object...) on a proxy class in a dynamic module
> > will throw IllegalAccessException; Proxy.newProxyInstance method should be
> > used instead". It seem that something goes wrong when Groovy tries to
> > create proxy for SAM[2]
> >
> > [1]
> > https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/reflect/Proxy.html#dynamicmodule
> > [2]
> > https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/reflection/stdclasses/CachedSAMClass.java#L69-L91
> >
> > Cheers,
> > Daniel Sun
> > On 2021/04/22 12:24:39, Graeme Rocher  wrote:
> > > Hi all,
> > >
> > > We are close to getting Micronaut's JDK 16 builds passing however some
> > > tests are failing that are related to Groovy and Spock that I am unsure
> > how
> > > to fix.
> > >
> > > Most of the errors are like:
> > >
> > > java.lang.reflect.InvocationTargetException
> > > at org.codehaus.groovy.vmplugin.v9.Java9.of(Java9.java:160)
> > > at
> > >
> > org.codehaus.groovy.vmplugin.v9.Java9.getInvokeSpecialHandle(Java9.java:179)
> > > at
> > >
> > java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
> > > at io.micronaut.core.io.WritableSpec.test flush is
> > > called(WritableSpec.groovy:13)
> > > Caused by: java.lang.IllegalAccessException: module jdk.proxy3 does not
> > > open jdk.proxy3 to unnamed module @71559e7c
> > > at
> > >
> > java.base/java.lang.invoke.MethodHandles.privateLookupIn(MethodHandles.java:260)
> > > ... 4 more
> > >
> > > Which seems to be related to the creation of proxies for closures as the
> > > code in question that fails looks like:
> > >
> > > @Get(value = "/welcome", produces = MediaType.TEXT_PLAIN)
> > > Writable render() { // <2>
> > > { writer ->
> > > template.make( // <3>
> > > firstName: "Fred",
> > > lastName: "Flintstone"
> > > ).writeTo(writer)
> > > }
> > > }
> > >
> > > There is a single other failure with this Spock error message:
> > >
> > > Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make
> > > field static final java.lang.invoke.MethodHandles$Lookup
> > > java.lang.invoke.MethodHandles$Lookup.IMPL_LOOKUP accessible: module
> > > java.base does not "opens java.lang.invoke" to unnamed module @533e0c7
> > > at
> > >
> > org.spockframework.mock.runtime.DefaultMethodInvoker.respond(DefaultMethodInvoker.java:50)
> > > ... 27 more
> > >
> > >
> > > Are these problems something that has been resolved or being looked at? I
> > > haven't seen anything with a brief look through the issue tracker.
> > >
> > > Thanks for the feedback
> > > --
> > > Graeme Rocher
> > >
> >
> 
> 
> -- 
> Graeme Rocher
> 


Re: Groovy with JDK 16

2021-04-25 Thread Daniel Sun
Hi Graeme,

> Caused by: java.lang.IllegalAccessException: module jdk.proxy3 does not open 
> jdk.proxy3 to unnamed module @71559e7c

At a fast glance, "jdk.proxy3" is a dynamic module[1], "Calling 
Constructor.newInstance(Object...) on a proxy class in a dynamic module will 
throw IllegalAccessException; Proxy.newProxyInstance method should be used 
instead". It seem that something goes wrong when Groovy tries to create proxy 
for SAM[2]

[1] 
https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/reflect/Proxy.html#dynamicmodule
[2] 
https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/reflection/stdclasses/CachedSAMClass.java#L69-L91

Cheers,
Daniel Sun
On 2021/04/22 12:24:39, Graeme Rocher  wrote: 
> Hi all,
> 
> We are close to getting Micronaut's JDK 16 builds passing however some
> tests are failing that are related to Groovy and Spock that I am unsure how
> to fix.
> 
> Most of the errors are like:
> 
> java.lang.reflect.InvocationTargetException
> at org.codehaus.groovy.vmplugin.v9.Java9.of(Java9.java:160)
> at
> org.codehaus.groovy.vmplugin.v9.Java9.getInvokeSpecialHandle(Java9.java:179)
> at
> java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
> at io.micronaut.core.io.WritableSpec.test flush is
> called(WritableSpec.groovy:13)
> Caused by: java.lang.IllegalAccessException: module jdk.proxy3 does not
> open jdk.proxy3 to unnamed module @71559e7c
> at
> java.base/java.lang.invoke.MethodHandles.privateLookupIn(MethodHandles.java:260)
> ... 4 more
> 
> Which seems to be related to the creation of proxies for closures as the
> code in question that fails looks like:
> 
> @Get(value = "/welcome", produces = MediaType.TEXT_PLAIN)
> Writable render() { // <2>
> { writer ->
> template.make( // <3>
> firstName: "Fred",
> lastName: "Flintstone"
> ).writeTo(writer)
> }
> }
> 
> There is a single other failure with this Spock error message:
> 
> Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make
> field static final java.lang.invoke.MethodHandles$Lookup
> java.lang.invoke.MethodHandles$Lookup.IMPL_LOOKUP accessible: module
> java.base does not "opens java.lang.invoke" to unnamed module @533e0c7
> at
> org.spockframework.mock.runtime.DefaultMethodInvoker.respond(DefaultMethodInvoker.java:50)
> ... 27 more
> 
> 
> Are these problems something that has been resolved or being looked at? I
> haven't seen anything with a brief look through the issue tracker.
> 
> Thanks for the feedback
> -- 
> Graeme Rocher
> 


Re: [ANNOUNCE] Groovy 3.0.8 and 4.0.0-alpha-3 Windows installers released

2021-04-19 Thread Daniel Sun
Nice work, Keegan!

Cheers,
Daniel Sun

On 2021/04/19 22:50:19, Keegan Witt  wrote: 
> Windows installers for the latest Groovy releases are now available. These
> are the first releases to be on our Bintray replacement, now that it's been
> sunset
> <https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/>.
> All versions previously released to Bintray can be found in directories
> under
> https://groovy.jfrog.io/ui/repos/tree/General/dist-release-local%2Fgroovy-windows-installer
> .
> 
> 
>- 3.0.8:
>
> https://groovy.jfrog.io/artifactory/dist-release-local/groovy-windows-installer/groovy-3.0.8/groovy-3.0.8.msi
>- 4.0.0-alpha-3:
>
> https://groovy.jfrog.io/artifactory/dist-release-local/groovy-windows-installer/groovy-4.0.0-alpha-3/groovy-4.0.0-alpha-3.msi
> 
> -Keegan
> 


Re: [ANNOUNCE] Apache Groovy 4.0.0-alpha-3 released

2021-04-16 Thread Daniel Sun
Nice work, Paul!

Cheers,
Daniel Sun

On 2021/04/16 05:57:30, Paul King  wrote: 
> Dear community,
> 
> The Apache Groovy team is pleased to announce version 4.0.0-alpha-3 of
> Apache Groovy.
> Apache Groovy is a multi-faceted programming language for the JVM.
> Further details can be found at the https://groovy.apache.org website.
> 
> This is a pre-release of a new version of Groovy and the last anticipated
> alpha for Groovy 4.
> We greatly appreciate any feedback you can give us when using this version.
> 
> This release includes 152 bug fixes/improvements as outlined in the
> changelog:
> https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12318123=12349469
> 
> Sources, convenience binaries, downloadable documentation and an SDK
> bundle can be found at: https://groovy.apache.org/download.html
> We recommend you verify your installation using the information on that
> page.
> 
> Jars are also available within the major binary repositories.
> 
> We welcome your help and feedback and in particular want
> to thank everyone who contributed to this release.
> 
> For more information on how to report problems, and to get involved,
> visit the project website at https://groovy.apache.org/
> 
> Best regards,
> 
> The Apache Groovy team.
> 


Re: recognise empty closure?

2021-02-17 Thread Daniel Sun
Groovy does not support checking empty closure at runtime AFAIK, but we could 
check and set some property to closure while compiling, then get the property 
at runtime. It will be an new improvement, not sure if others like it or not.

Cheers,
Daniel Sun

On 2021/02/17 15:06:47, OCsite  wrote: 
> Hi there,
> 
> is it possible to reliably recognise an empty closure, i.e., „{}“, 
> programmatically? 
> 
> def foo(Closure bar) {
>   if (?bar-is-empty?) throw new Exception('The closure cannot be empty!')
>   else bar()
> }
> foo { println "ok" } // OK
> foo { 1 } // OK
> foo { } // throws
> 
> Thanks!
> OC


Re: [ANNOUNCE] Groovy 2.4.21, 2.5.14, and 3.0.7 Windows installers released

2020-12-04 Thread Daniel Sun
Nice work, Keegan.

Cheers,
Daniel Sun

On 2020/12/04 04:48:06 Keegan Witt wrote:
> Windows installers for the latest Groovy releases are now available.
> 
> 2.4.21:
> https://bintray.com/groovy/Distributions/download_file?file_path=groovy-2.4.21.msi
> 2.5.14:
> https://bintray.com/groovy/Distributions/download_file?file_path=groovy-2.5.14.msi
> 3.0.7:
> https://bintray.com/groovy/Distributions/download_file?file_path=groovy-3.0.7.msi
> 
> -Keegan
> 


Re: GMavenPlus 1.11.1 Released

2020-11-30 Thread Daniel Sun
Nice work!

Cheers,
Daniel Sun

On 2020/12/01 04:22:54, Keegan Witt  wrote: 
>  Bugs
> 
>- Fixes IllegalArgumentException when consoleScript parameter was loaded
>from POM rather than command line property.
> 
> Enhancements
> None
> Potentially breaking changes
> None
> Notes
> 
> None
> 
> *Getting help / reporting bugs*
> 
> As usual, let me know of any bugs you encounter either on our user mailing
> list <http://groups.google.com/group/gmavenplus>, GitHub issues
> <https://github.com/groovy/GMavenPlus/issues>, or Slack
> <https://groovy-community.slack.com/messages/C2SLAV9FY/>.
> 
> Enjoy!
> 


Re: groovysh and long input

2020-10-19 Thread Daniel Sun


I think the performance issue could be related to groovysh but not the new 
parser.
Here the result of running my script[1], as you could see, it works well:
```
D:\_TEMP\yyy>groovy Test.groovy
result: 5500; elapsed time: 261ms

D:\_TEMP\yyy>groovy Test.groovy
result: 5500; elapsed time: 240ms

D:\_TEMP\yyy>groovy Test.groovy
result: 5500; elapsed time: 275ms

D:\_TEMP\yyy>groovy Test.groovy
result: 5500; elapsed time: 249ms

D:\_TEMP\yyy>groovy Test.groovy
result: 5500; elapsed time: 259ms

D:\_TEMP\yyy>groovy -v
Groovy Version: 3.0.6 JVM: 15 Vendor: Azul Systems, Inc. OS: Windows 10
```

Cheers,
Daniel Sun

[1] my script:
```
def begin = System.currentTimeMillis() 

// 500 lines of "1 + 10 +"
def result = new GroovyShell().evaluate '''
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 +  
1 + 10 +  
1 + 10 +
1 + 10 + 
1 + 10 + 
1 + 10 + 

Re: groovysh and long input

2020-10-19 Thread Daniel Sun


Please try 3.0.6+, we have tuned the performance a lot.

Cheers,
Daniel Sun
On 2020/10/16 18:58:28, Stephen Mallette  wrote: 
> Hello,
> 
> I happened to be testing some issues related to this pull request I
> submitted the other day:
> 
> https://github.com/apache/groovy/pull/1405
> 
> In testing between groovy 2.5.x and 3.x I've noticed a considerable
> performance difference when pasting long multi-lined scripts. 2.5.x is
> quite quick to accept the input whereas 3.x seems to slow more and more as
> additional lines are consumed. While I did more complex tests trying to get
> to the bottom of the problem, it's fairly easy to recreate with a simple
> addition script:
> 
> 1 + 10 +
> 1 + 10 +
> 1 + 10 +
> 1 + 10 +
> 1 + 10 +
> ... repeated a bunch of times and then ended with
> 1
> 
> copy that out of your text editor and just paste it into both versions of
> groovsh and see the difference. I've found 500 lines demonstrates it well
> but you could probably get away with less and still see the difference of
> evaluation at play.
> 
> I tried to do some profiling to try to isolate the problem myself, but
> things got a little too deep into antlr4 for me and I got lost. Does anyone
> have any ideas as to what might be different for 3.x?
> 


Re: Omitting parentheses on .size() ?

2020-07-31 Thread Daniel Sun


The parentheses of methods without parameters could not be ommitted.

`[1, 2, 3].size` is accessing the private field `size` of `ArrayList`, so 
illegal reflective access warning will be thrown.

Cheers,
Daniel Sun
On 2020/08/01 00:49:54, paul  wrote: 
> Hi all,
> 
> (on latest groovy 3.0.5 and OpenJDK 14) omitting the empty parentheses to the 
> .size() call works, but throws an illegal reflective access warning:
> 
> ```
> groovy:000> [1,2,3].size
> WARNING: An illegal reflective access operation has occurred
> WARNING: Illegal reflective access by 
> org.codehaus.groovy.reflection.ReflectionUtils 
> (file:/home/paul/.sdkman/candidates/groovy/3.0.5/lib/groovy-3.0.5.jar) to 
> field java.util.ArrayList.size
> WARNING: Please consider reporting this to the maintainers of 
> org.codehaus.groovy.reflection.ReflectionUtils
> WARNING: Use --illegal-access=warn to enable warnings of further illegal 
> reflective access operations
> WARNING: All illegal access operations will be denied in a future release
> ===> 3
> ```
> 
> Curiously, the size() method seems to be the only parameter-less method where 
> I can
> omit the empty parentheses – all others throw a MissingPropertyException (as 
> expected).
> 
> What is the desired behaviour, and why is it even working (albeit with 
> warnings) with .size ?
> 
> 
> best
> paul
> -- 
> typed with Neo 2 -- an ergonomically optimized keyboard layout
> for German, English, programming, and science
> ❤ http://neo-layout.org
> ❤ https://useplaintext.email
> ❤ YY-MM-DD dates (ISO 8601/RFC 3339)
> � UTF-8 encoding
> 


Re: GMavenPlus 1.9.1 Released

2020-07-26 Thread Daniel Sun
Nice work, Keegan.

Cheers,
Daniel Sun
On 2020/07/26 20:01:21, Keegan Witt  wrote: 
>  Bugs
> 
> None
> Enhancements
> 
>- Add a property to skip script execution (#162
><https://github.com/groovy/GMavenPlus/issues/162>)
> 
> Potentially breaking changesNone
> Notes None
> 
> *Getting help / reporting bugs*
> 
> As usual, let me know of any bugs you encounter either on our user mailing
> list <http://groups.google.com/group/gmavenplus>, GitHub issues
> <https://github.com/groovy/GMavenPlus/issues>, or Slack
> <https://groovy-community.slack.com/messages/C2SLAV9FY/>.
> 
> Enjoy!
> 


Re: What projects use Groovy as its main development language ?

2020-06-27 Thread Daniel Sun
MIP(aka Murex Interface Platform) of BEA is developed with Groovy 3.

There are about tens of thousands LOC in groovy files.

P.S. I am not able to provide accurate LOC because I do not work for BEA any 
more...

Cheers,
Daniel Sun
On 2020/06/26 22:24:24, MG  wrote: 
> A quick survey: Who on this mailing list works on or knows of a project 
> where Groovy is the main language of development, i.e. it is not used as 
> "just" a script or DSL language in addition to e.g. Java ?
> If possible name the company/country/project and give some impression of 
> the size of the project (lines of code, # of people working on it, etc), 
> timeframe of development, and whether it is os or commercial (or both) G-)
> 
> Thanks in advance,
> cheers,
> mg
> 
> 
> 
> 


Re: GMavenPlus 1.7.0 Released

2019-05-06 Thread Daniel Sun
Nice work, Keegan.

Cheers,
Daniel.Sun




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: Groovy closure $v

2019-04-02 Thread Daniel Sun
My pleasure ;-)



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: Which issue do you MOST want to fix

2019-02-20 Thread Daniel Sun
Hi Mauro,

The issue you most want to fix is fixed:
https://github.com/apache/groovy/commit/f9ebd615cb5d5f766a30b2a6e904084acece

Cheers,
Daniel.Sun




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: Groovy file associations on Windows

2019-02-11 Thread Daniel Sun
Yep. e.g. banks usually does not allow employees access Internet. Luckily
some of them will setup maven server.

Cheers,
Daniel.Sun




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: GraalVM with Groovy and Grape

2019-01-16 Thread Daniel Sun
Nice post. I've read it.

Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: [PROPOSAL]About creating open collective for Groovy programming language in the name of Groovy Community

2019-01-08 Thread Daniel Sun
Here is the introduction of Open Source Collective 501c6 (Non Profit):
https://opencollective.com/opensourcecollective

Cheers,
Daniel.Sun




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: [PROPOSAL]About creating open collective for Groovy programming language in the name of Groovy Community

2019-01-08 Thread Daniel Sun
Hi Paul,

> (1) Since we don't use the "groovy/groovy-core" repo any longer, I don't
> think that is the correct one to use but rather "apache/groovy". 

 As you said in (2), `According to official Apache policy, the ASF
doesn't accept "cash for code"`, I am not sure we can create open collective
for "apache/groovy"(BTW, I can not access "apache/groovy" via my github
account).
 If we can not use "apache/groovy" to create open collective,
"groovy/groovy-core" may be better, but we have to explain the reason in the
open collective.

> Also, while the Android Groovy Gradle plugin is no doubt a worthy
> recipient of additional funds, I would be inclined to keep it simple and
> focus on core Groovy for now. 
 Agreed.

> this would need to be a community-driven effort rather than an official
> Apache organised activity

 Yep. That's the reason why I sent the email via my personal hotmail. 

> The wording could say "Friends of Groovy", or "All Things Groovy" (to
> mimic the facebook group) or "Gr8 Technologies" rather than "Apache Groovy
> project" or similar. 

 "I would be inclined to keep it simple and focus on core Groovy for
now. ",  I think wording focuses on core Groovy would be better, e.g.
"Groovy Programming Language"?

>  I suspect, we (as the Apache project) would need to maintain oversight of
> the collective to make sure of this. As far as I know this is slightly
> uncharted territory. 

 The opencollective site will record all "contribute" and "submit
expense", which is open to all people, e.g.
https://opencollective.com/vuejs#budget

> (4) While sponsorship is below what we'd like and below what it has been
> at some previous points in Groovy life, it isn't 0. We have several
> existing sponsors, e.g. OCI. The wording about the collective should take
> that into consideration. 

 Yep. OCI is a great company for Groovy! We always appreciate its
sponsorship.

  Let's imagine that would be really great if more people involve into
developing Groovy, more big features(e.g. MOP2, async/await) are completed
and hard issues(e.g. generics of STC) are fixed every year :-)

Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: [ANNOUNCE] Groovy 2.5.4 Windows Installer Released

2018-11-11 Thread Daniel Sun
Nice work!

Cheers,
Daniel.Sun




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: [ANNOUNCE] Apache Groovy 2.5.4 released

2018-11-11 Thread Daniel Sun
Nice work, Paul.

Cheers,
Daniel.Sun




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: [Poll] About supporting Java-like array

2018-05-02 Thread Daniel Sun
FYI, here is the poll result from
twitter(https://twitter.com/daniel_sun/status/990544485196091395): 

19 votes in total,
58% +1, 
42%   0, 
 0%   -1

Cheers,
Daniel.Sun




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: [Poll] About supporting Java-like array

2018-05-01 Thread Daniel Sun
Hi Jochen,

  Supporting Java-like array is to copy & paste code in Java easily,
e.g. experiment Java code in groovy console :-)

> I really don't think Groovy has to support everything from Java. 
  I agree. If we could improve the compatibility between Groovy and
Java, it would be good for groovy users as most of them are Java developers.

  Your opinion is ?(+1 \ 0 \ -1)   ;-)

Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: [Poll] About supporting Java-like array

2018-04-29 Thread Daniel Sun
Hi mg,

 As far as I remember, two dimensional array like`int[][] a = [[1, 2,
3], [4, 5, 6]]` will go wrong in the Groovy style.

Cheers,
Daniel.Sun




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: [ANNOUNCE] Apache Groovy 3.0.0-alpha-2 released

2018-04-19 Thread Daniel Sun
For gradle user:

group 'me.sunlan'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
compile group: 'org.codehaus.groovy', name: 'groovy-all', version:
'3.0.0-alpha-2'
}


Cheers,
Daniel.Sun




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: [ANNOUNCE] Apache Groovy 3.0.0-alpha-2 released

2018-04-19 Thread Daniel Sun
`pom` is not required. FYI:


http://maven.apache.org/POM/4.0.0;
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd;>
4.0.0

me.sunlan
try-groovy-via-mvn
1.0-SNAPSHOT



org.codehaus.groovy
groovy-all
3.0.0-alpha-2





Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: [ANNOUNCE] Apache Groovy 3.0.0-alpha-2 released

2018-04-19 Thread Daniel Sun
Hi  Francesco,

  You should still be able to use groovy-all, but the relevant
individual JARs will be downloaded(not the original 
 fat jar file groovy-all.jar).


org.codehaus.groovy
groovy-all
3.0.0-alpha-2
pom


 Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: [ANNOUNCE] Apache Groovy 3.0.0-alpha-2 released

2018-04-17 Thread Daniel Sun
Paul, thanks for your help during the release :-)




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: [ANNOUNCE] Groovy 2.5.0-rc-1 Windows Installer Released

2018-04-16 Thread Daniel Sun
Nice work. Thanks!



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: Groov 3.0 - nested code blocks - block/eval

2018-03-20 Thread Daniel Sun
Hi mg,

 Parrot is smart enough to distinguish closure and code block, so
`block` is not necessary. BTW, new keywords may break existing code ;)

 As for `eval`, we can use `{ /* do something here */ }()` instead, e.g.
`{ 'abc' }()`

P.S. I am open to any proposal for grammar ;-)

Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: Vote for Groovy 3 support in IntelliJ :-)

2018-03-15 Thread Daniel Sun
Done :-)

Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: [ANNOUNCE] Apache Groovy 2.4.14 released

2018-03-02 Thread Daniel Sun
That's great!

2.6.0-alpha-3 and 3.0.0-alpha-2 are coming soon ;-)

Cheers,
Daniel.Sun




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: ConcurrentModificationException with use of memoize

2018-03-02 Thread Daniel Sun
Hi Don,

 The issue should be fixed in 2.5.0+(NOT included in 2.5.0-beta-3),
please reference the thread about jitpack to give it a try:

http://groovy.329449.n5.nabble.com/JitPack-for-Groovy-tp5747625.html

Cheers,
Daniel.Sun




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


JitPack for Groovy

2018-02-22 Thread Daniel Sun
Hi all,

 I have created a demo project to show how to try Groovy in a Java
project via JitPack. Here is the link to the project repository:
https://github.com/danielsun1106/try-jitpack

 The key parts of build.gradle is shown as follows:
```
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}

dependencies {
compile 'com.github.apache:groovy:master-SNAPSHOT' // See
https://jitpack.io/#apache/groovy
}

//  ensure Gradle always picks up the ‘freshest’ version of the build
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'  
}
```

  I hope JitPack can help more groovy users try the latest version of
Groovy easily and give us feedback as soon as possible.

Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: Groovy Champions proposal feedback

2018-02-18 Thread Daniel Sun
Hi Paul,

 “Groovy Champions” make people associate it with "Java Champions"
easily. As for "Groovy Stars", it is interesting but let me associate "Song
Stars" and "Kungfu Stars" easily... I wish other people would not associate
as I do...

  Similarly, many years ago some one suggested to name current "Grape"
as "Groovy Baby", the latter is interesting but not formal...

  To sum up, +1 to “Groovy Champions”.

Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: Executing Groovy DSL scripts concurrently

2018-02-07 Thread Daniel Sun
Hi Adithyan,

 How about caching the class instance and reuse it? Here are some
scratch code for your reference:

```
static LRUCache lruCache = new LRUCache(100);

def dslSrc = '''
your DSL source code
'''
def md5 = md5(dslSrc)
def resultClass = lruCache.getAndPut(md5, k -> new GroovyShell().parse
dslSrc)  
```

Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: Sample Forum

2018-01-17 Thread Daniel Sun
Hi Nathan,

  Thanks for your spending time on setting up the forum. I tried just
now, it's amazing!

   As for the following feature about delay sending, I wish you could
remove it(and wish send the mail without any delay)... because if we are
editing and have not completed in 2 minutes but the mail is sent, then the
mail is not complete...
```
Quick note: when you 
post a topic, there is a 2 minute window in which you can make edits before 
it is sent out to email subscribers, so if you experience delay that is why. 
```

   P.S. I replied your "Improving named-argument support" thread,
looking forward to seeing it in mailing list ;-)

Cheers,
Daniel.Sun


Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: [ANN] Announcing CodeNarc 1.1

2018-01-14 Thread Daniel Sun
Nice work!

Cheers,
Daniel.Sun




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: setting up maven environment

2018-01-11 Thread Daniel Sun
FYI,
http://docs.groovy-lang.org/latest/html/documentation/tools-groovyc.html#_maven_integration

Cheers,
Daniel.Sun




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: GPars 2 Stuff

2018-01-07 Thread Daniel Sun
Hi Russel,

   `[1, 2, 3, 4, 5].parallel.reduce{a, b -> Math.min(a, b)}` is much
groovier than ` [1, 2, 3, 4, 5].parallelStream().reduce{a, b -> Math.min(a,
b)}.get()`, so I hope the original API can be kept and its implementation
can base on Java8's functionality.

Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: Start a forum - continued

2018-01-02 Thread Daniel Sun
Hi  Nathan,

   It's easy to discuss via a forum, so I vote +1 here. According to
Apache policy, we should discuss via mailing lists, so the forum integrate
with the mailing lists to exchange messages between the two system.

   Whether the forum is official or not, the forum will attract more and
more Groovy users and developers if the forum can integrate with the mailing
lists IMO.

Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: Apache Groovy and language influences

2017-10-04 Thread Daniel Sun
Nice :)



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: About using groovyConsole under Java9

2017-09-22 Thread Daniel Sun
Java will not ignore unknown option e.g. --add-modules, so we should add
option conditionally:
https://github.com/apache/groovy/commit/ca05e9ff8f217d5ac16a87fff7023a481b9c1b3f



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: About using groovyConsole under Java9

2017-09-21 Thread Daniel Sun
The next release of 2.6.0+ will add the option `--add-modules ALL-SYSTEM` by
default:
https://github.com/apache/groovy/commit/e6b62dfa1fc5b6471304dfe5244e84f7f6987392

Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html


Re: Start a forum using Discourse

2017-08-20 Thread Daniel Sun
Hi Guillaume,

  Maybe we can encourage groovy developers to set up some non-official
forums, which are similar to what Java does (
http://javarevisited.blogspot.jp/2015/01/top-5-java-forums-for-programmers.html
) and will warm up Groovy community further more.

Cheers,
Daniel.Sun



--
View this message in context: 
http://groovy.329449.n5.nabble.com/Start-a-forum-using-Discourse-tp5742677p5742699.html
Sent from the Groovy Users mailing list archive at Nabble.com.


Re: Start a forum using Discourse

2017-08-19 Thread Daniel Sun
Hi  Nathan,

  I like your idea :)

Cheers,
Daniel.Sun



--
View this message in context: 
http://groovy.329449.n5.nabble.com/Start-a-forum-using-Discourse-tp5742677p5742679.html
Sent from the Groovy Users mailing list archive at Nabble.com.


Re: [VOTE]About the Union Type for method/constructor declaration

2017-07-23 Thread Daniel Sun
Because many people do not like the feature, it will not be implemented for
the time being util we reach a consensus.

P.S. It is actually a poll.

Cheers,
Daniel.Sun




--
View this message in context: 
http://groovy.329449.n5.nabble.com/VOTE-About-the-Union-Type-for-method-constructor-declaration-tp5742265p5742283.html
Sent from the Groovy Users mailing list archive at Nabble.com.


回复:upcoming release(s)

2017-07-23 Thread Daniel Sun
According to the original plan, the Parrot parser will be the default parser 
for Groovy 3.0.0 eventually. But currently about 20 tests(e.g. different error 
messages) fail when setting Parrot as default, so we will try our best to fix 
them all before releasing GA version.

Cheers,
Daniel.Sun


 原始邮件 
主题:Re: upcoming release(s)
发件人:"Russel Winder-3 [via Groovy]"
收件人:Daniel Sun
抄送:


On Sun, 2017-07-23 at 04:55 -0700, Daniel Sun wrote:
> Looking forward to 2.6.0 and 3.0.0, which contains the Parrot parser
> providing many new features :)
>
> p.s. use  -Dgroovy.antlr4=true  to enable the Parrot parser
>

Will the new parser not be the default in Groovy 3?

--
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:[hidden 
email]
41 Buckmaster Roadm: +44 7770 465 077   xmpp: [hidden 
email]
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

[http://groovy.329449.n5.nabble.com/images/icon_attachment.gif] signature.asc 
(849 bytes) Download 
Attachment<http://groovy.329449.n5.nabble.com/attachment/5742277/0/signature.asc>



If you reply to this email, your message will be added to the discussion below:
http://groovy.329449.n5.nabble.com/upcoming-release-s-tp5742269p5742277.html
To unsubscribe from upcoming release(s), click 
here<http://groovy.329449.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code=5742269=cmVhbGJsdWVzdW5AaG90bWFpbC5jb218NTc0MjI2OXwxMTQ2MjE4MjI1>.
NAML<http://groovy.329449.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer=instant_html%21nabble%3Aemail.naml=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: 
http://groovy.329449.n5.nabble.com/upcoming-release-s-tp5742278.html
Sent from the Groovy Users mailing list archive at Nabble.com.

Re: [VOTE]About the Union Type for method/constructor declaration

2017-07-23 Thread Daniel Sun
Hi Jochen,

As you said, it is actually union overloads. Fully supporting union type
is a big task. So I did not propose union type defination etc. for the time
being ;)

Cheers,
Daniel.Sun




--
View this message in context: 
http://groovy.329449.n5.nabble.com/VOTE-About-the-Union-Type-for-method-constructor-declaration-tp5742265p5742274.html
Sent from the Groovy Users mailing list archive at Nabble.com.


[VOTE]About the Union Type for method/constructor declaration

2017-07-22 Thread Daniel Sun
Hi all,

   I've been thinking about Union Type for method/constructor
declaration. It is similar to multi-catch in try-catch statement, e.g.

class UnionTypeSample {
  public UnionTypeSample(A|B|C p) {
 // do something
  }

  def m(D|E p) {
// do something
  }
}

  Groovy will translate the above code into the following code, which is
also the same way how multi-catch is handled.

class UnionTypeSample {
  public UnionTypeSample(A p) {
 // do something
  }

  public UnionTypeSample(B p) {
 // do something
  }

  public UnionTypeSample(C p) {
 // do something
  }

  def m(D p) {
// do something
  }

  def m(E p) {
// do something
  }
}

 Any thoughts?
--
  [+1] I like it
  [  0] Not bad
  [-1] I do not like it
--

Cheers,
Daniel.Sun



--
View this message in context: 
http://groovy.329449.n5.nabble.com/VOTE-About-the-Union-Type-for-method-constructor-declaration-tp5742265.html
Sent from the Groovy Users mailing list archive at Nabble.com.


Re: Exciting Addition to Groovy Ecosystem

2017-07-07 Thread Daniel Sun
Hi Edmond,

   Its UI is impressive. If the tabs could be moved, the usability will
be better ;)

Cheers,
Daniel.Sun



--
View this message in context: 
http://groovy.329449.n5.nabble.com/Exciting-Addition-to-Groovy-Ecosystem-tp5742007p5742008.html
Sent from the Groovy Users mailing list archive at Nabble.com.


Re: JSR 308 support for Groovy

2017-06-13 Thread Daniel Sun
Hi Paul,

   I'm reading an article on JSR308, which is really useful.
http://www.oracle.com/technetwork/articles/java/ma14-architect-annotations-2177655.html

   In addition, I've already created a branch
jsr308(https://github.com/danielsun1106/groovy-parser/tree/jsr308) to
experiment the grammar.  Before working on it, I want to confirm whether
Groovy will support JSR308 fully.

P.S. The following code is quite strange for me ;-)
Forecast @Readonly [] fiveDay = new Forecast @Readonly [5];

Cheers,
Daniel.Sun



--
View this message in context: 
http://groovy.329449.n5.nabble.com/JSR-308-support-for-Groovy-tp5741586p5741627.html
Sent from the Groovy Users mailing list archive at Nabble.com.


Re: JSR 308 support for Groovy

2017-06-12 Thread Daniel Sun
Hi Paul,

> The grammar isn't expecting an annotation on the parameterized type. It
> fails for both the old and new parsers with slightly different error
> messages.

  I will set aside some time to complete the grammar and AST
construction.

Cheers,
Daniel.Sun



--
View this message in context: 
http://groovy.329449.n5.nabble.com/JSR-308-support-for-Groovy-tp5741586p5741591.html
Sent from the Groovy Users mailing list archive at Nabble.com.


Re: Java 8 Date/Time API Extension Methods

2017-06-08 Thread Daniel Sun
Hi Joe,
  
  Thanks for your awesome work. I like it.

Cheers,
Daniel.Sun




--
View this message in context: 
http://groovy.329449.n5.nabble.com/Java-8-Date-Time-API-Extension-Methods-tp5740663p5741533.html
Sent from the Groovy Users mailing list archive at Nabble.com.


Re: Maven coordinates going forward

2017-03-27 Thread Daniel Sun

> The two are independent. I suggest changing both at the same time would
be the right thing to do. 

Agreed!


Cheers,
Daniel.Sun



--
View this message in context: 
http://groovy.329449.n5.nabble.com/Maven-coordinates-going-forward-tp5739395p5739409.html
Sent from the Groovy Users mailing list archive at Nabble.com.


Re: Official Docker Groovy images

2017-02-28 Thread Daniel Sun
Nice!



--
View this message in context: 
http://groovy.329449.n5.nabble.com/Official-Docker-Groovy-images-tp5738848p5738851.html
Sent from the Groovy Users mailing list archive at Nabble.com.


[VOTE]About the "implies" operator(=>) for Groovy 3

2017-01-26 Thread Daniel Sun
Hi all,

  The new parser(Parrot) supports "implies" operator(=>) now, e.g. 

// if and only if isDistributedTxFailed is true and isCompensated is false,
yields notConsistent.
if (isDistributedTxFailed => isCompensated) {
println 'eventuallyConsistent '
} else {
println 'notConsistent'
}

// One more example:
if (itIsRaining => iAmUsingUmbrella) {
  println 'I am dry'
} else {
  println 'I am wet'
}

   *More examples can be found at:*
1)
https://github.com/danielsun1106/groovy-parser/blob/impliesOperator/src/test/resources/core/ImpliesOp_01x.groovy
2)
https://github.com/danielsun1106/groovy-parser/blob/impliesOperator/src/test/resources/core/ImpliesOp_02x.groovy
3)
https://github.com/danielsun1106/groovy-parser/blob/impliesOperator/src/test/resources/core/ImpliesOp_03x.groovy

*Background of the "implies" operator(=>) :*
http://mathworld.wolfram.com/Implies.html
*Please let us know whether you like it, vote here:
*https://twitter.com/daniel_sun/status/824552059395465218

Cheers,
Daniel.Sun



--
View this message in context: 
http://groovy.329449.n5.nabble.com/VOTE-About-the-implies-operator-for-Groovy-3-tp5738129.html
Sent from the Groovy Users mailing list archive at Nabble.com.


Re: println slashy string

2016-12-08 Thread Daniel Sun
Parrot's lexer will also reject the code too, but Parrot parser supports
printing a dollar slashy string:

println $/hello/$   // yield hello. *Notice: *the old parser does not
support the code


Cheers,
Daniel.Sun



--
View this message in context: 
http://groovy.329449.n5.nabble.com/println-slashy-string-tp5737139p5737152.html
Sent from the Groovy Users mailing list archive at Nabble.com.


Re: [VOTE] new operator ?=

2016-11-28 Thread Daniel Sun
Interesting, but hard to understand somehow at the first time hearing the name 
;)

Cheers,
Daniel.Sun



在 "jeff.l [via Groovy]" <ml-node+s329449n5737052...@n5.nabble.com>,2016年11月29日 
上午8:30写道:

Elsignment?

— Jeff



On Nov 23, 2016, at 4:30 PM, Daniel Sun <[hidden email]> wrote:

I like the nickname "Elvis assignment" for ?=

Cheers,
Daniel.Sun



在 2016年11月24日 04:18,"Guillaume Laforge [via Groovy]" <ml-node+[hidden email]>写道:[hidden email]> wrote:
Elvis assignment?

On Wed, Nov 23, 2016 at 1:47 PM Andres Almiray <[hidden email]> wrote:
Long live pompaduor walrus ...

What would be an appropriate nickname for ?=, I wonder.

---
Java Champion; Groovy Enthusiast
http://jroller.com/aalmiray
http://www.linkedin.com/in/aalmiray
--
What goes up, must come down. Ask any system administrator.
There are 10 types of people in the world: Those who understand binary, and 
those who don't.
To understand recursion, we must first understand recursion.

On Wed, Nov 23, 2016 at 7:35 PM, Paul King <[hidden email]> wrote:
For all our other operators of the form:

a X= b

it is shorthand for:

a = a X b

So, to follow that convention the operator is:

a ?:= b

which as per previous discussions is a bit cumbersome, so I am +1 for
the shortened form so long as we document appropriately.

Paul.


On Thu, Nov 24, 2016 at 3:54 AM, Gerald Wiltse <[hidden email]> wrote:
> +1
>
> Gerald R. Wiltse
>  target="_top" rel="nofollow" link="external" class=""> [hidden email]
>
>
> On Wed, Nov 23, 2016 at 12:28 PM, Winnebeck, Jason
> < target="_top" rel="nofollow" link="external" class="">[hidden email]> wrote:
>>
>> At first I was going to vote 0, because I feel like a = a ?: b is clear
>> (and I compare it to a = a || b from JS). However, looking at the dev list,
>> I definitely see a nice case for it:
>>
>> person.name.last = person.name.last ?: "unknown"
>>
>> When you have a non-trivial assignment expression, I see the benefit:
>>
>> person.name.last ?= "unknown"
>>
>> However, I feel like it is not intuitive or clear. But, I don't think the
>> operator hurts, and it's certainly not any less intuitive than <=> for
>> example or even ?: when seen for the very first time. It's an easy look up
>> in Groovy docs, and if you don't know it and don't use it, it's not a huge
>> loss. So it doesn't hurt to add it, and while not instantly readable, it's a
>> trivial docs lookup when someone is reading the code.
>>
>> So, I vote +1. But, honestly, I don't see myself using it very often as
>> I'd normally use Elvis at time of initial assignment. I wouldn't put it very
>> high on a prioritized backlog of things to improve for Groovy.
>>
>> Jason
>>
>> -Original Message-
>> From: Daniel Sun [mailto:> href="x-msg://14/user/SendEmail.jtp?type=nodenode=5736959i=6" 
>> target="_top" rel="nofollow" link="external" class="">[hidden email]]
>> Sent: Wednesday, November 23, 2016 10:59 AM
>> To: > href="x-msg://14/user/SendEmail.jtp?type=nodenode=5736959i=7" 
>> target="_top" rel="nofollow" link="external" class=""> [hidden email]
>> Subject: [VOTE] new operator ?=
>>
>> Hi all,
>>
>>  If the new operator ?=  (e.g. a ?= 'foo'  is equivalent of  a = a ?:
>> 'foo') were to be added to Groovy programming language, do you like it?
>> (Yes: +1; No: -1; Not bad: 0)
>>
>> Cheers,
>> Daniel.Sun
>>
>>
>>
>> --
>> View this message in context:
>> http://groovy.329449.n5.nabble.com/VOTE-new-operator-tp5736931.html
>> Sent from the Groovy Users mailing list archive at 
>> Nabble.com<http://Nabble.com>.
>>
>> This email message and any attachments are for the sole use of the
>> intended recipient(s). Any unauthorized review, use, disclosure or
>> distribution is prohibited. If you are not the intended recipient, please
>> contact the sender by reply email and destroy all copies of the original
>> message and any attachments.
>
>




--
Guillaume Laforge
Apache Groovy committer & PMC Vice-President
Developer Advocate @ Google Cloud Platform

Blog: http://glaforge.appspot.com/
Social: @glaforge<http://twitter.com/glaforge> / 
Google+<https://plus.google.com/u/0/114130972232398734985/posts>



If you reply to this email, your message will be added to the discussion below:
http://groovy.329449.n5.nabble.com/VOTE-new-operator

Re: [VOTE] new operator ?=

2016-11-25 Thread Daniel Sun
As most of us vote +1, I'll try to implement the new feature after I fix some
major
issues(https://issues.apache.org/jira/browse/GROOVY-8005?jql=project%20%3D%20GROOVY%20AND%20resolution%20%3D%20Unresolved%20AND%20assignee%20%3D%20daniel_sun%20ORDER%20BY%20priority%20DESC)

Cheers,
Daniel.Sun



--
View this message in context: 
http://groovy.329449.n5.nabble.com/VOTE-new-operator-tp5736931p5737003.html
Sent from the Groovy Users mailing list archive at Nabble.com.


Re: [VOTE] new operator ?=

2016-11-23 Thread Daniel Sun
I like the nickname "Elvis assignment" for ?=

Cheers,
Daniel.Sun



在 2016年11月24日 04:18,"Guillaume Laforge [via Groovy]" 
<ml-node+s329449n5736959...@n5.nabble.com>写道:http://jroller.com/aalmiray
http://www.linkedin.com/in/aalmiray
--
What goes up, must come down. Ask any system administrator.
There are 10 types of people in the world: Those who understand binary, and 
those who don't.
To understand recursion, we must first understand recursion.

On Wed, Nov 23, 2016 at 7:35 PM, Paul King <[hidden 
email]> wrote:
For all our other operators of the form:

a X= b

it is shorthand for:

a = a X b

So, to follow that convention the operator is:

a ?:= b

which as per previous discussions is a bit cumbersome, so I am +1 for
the shortened form so long as we document appropriately.

Paul.


On Thu, Nov 24, 2016 at 3:54 AM, Gerald Wiltse <[hidden 
email]> wrote:
> +1
>
> Gerald R. Wiltse
> [hidden email]
>
>
> On Wed, Nov 23, 2016 at 12:28 PM, Winnebeck, Jason
> <[hidden email]> wrote:
>>
>> At first I was going to vote 0, because I feel like a = a ?: b is clear
>> (and I compare it to a = a || b from JS). However, looking at the dev list,
>> I definitely see a nice case for it:
>>
>> person.name.last = person.name.last ?: "unknown"
>>
>> When you have a non-trivial assignment expression, I see the benefit:
>>
>> person.name.last ?= "unknown"
>>
>> However, I feel like it is not intuitive or clear. But, I don't think the
>> operator hurts, and it's certainly not any less intuitive than <=> for
>> example or even ?: when seen for the very first time. It's an easy look up
>> in Groovy docs, and if you don't know it and don't use it, it's not a huge
>> loss. So it doesn't hurt to add it, and while not instantly readable, it's a
>> trivial docs lookup when someone is reading the code.
>>
>> So, I vote +1. But, honestly, I don't see myself using it very often as
>> I'd normally use Elvis at time of initial assignment. I wouldn't put it very
>> high on a prioritized backlog of things to improve for Groovy.
>>
>> Jason
>>
>> -Original Message-
>> From: Daniel Sun [mailto:[hidden 
>> email]]
>> Sent: Wednesday, November 23, 2016 10:59 AM
>> To: [hidden email]
>> Subject: [VOTE] new operator ?=
>>
>> Hi all,
>>
>>  If the new operator ?=  (e.g. a ?= 'foo'  is equivalent of  a = a ?:
>> 'foo') were to be added to Groovy programming language, do you like it?
>> (Yes: +1; No: -1; Not bad: 0)
>>
>> Cheers,
>> Daniel.Sun
>>
>>
>>
>> --
>> View this message in context:
>> http://groovy.329449.n5.nabble.com/VOTE-new-operator-tp5736931.html
>> Sent from the Groovy Users mailing list archive at Nabble.com.
>>
>> This email message and any attachments are for the sole use of the
>> intended recipient(s). Any unauthorized review, use, disclosure or
>> distribution is prohibited. If you are not the intended recipient, please
>> contact the sender by reply email and destroy all copies of the original
>> message and any attachments.
>
>




--
Guillaume Laforge
Apache Groovy committer & PMC Vice-President
Developer Advocate @ Google Cloud Platform

Blog: http://glaforge.appspot.com/
Social: @glaforge<http://twitter.com/glaforge> / 
Google+<https://plus.google.com/u/0/114130972232398734985/posts>



If you reply to this email, your message will be added to the discussion below:
http://groovy.329449.n5.nabble.com/VOTE-new-operator-tp5736931p5736959.html
To unsubscribe from [VOTE] new operator ?=, click 
here<http://groovy.329449.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code=5736931=cmVhbGJsdWVzdW5AaG90bWFpbC5jb218NTczNjkzMXwxMTQ2MjE4MjI1>.
NAML<http://groovy.329449.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer=instant_html%21nabble%3Aemail.naml=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: 
http://groovy.329449.n5.nabble.com/VOTE-new-operator-tp5736931p5736970.html
Sent from the Groovy Users mailing list archive at Nabble.com.

Re: Http Builder NG

2016-11-22 Thread Daniel Sun
Good job :)

Cheers,
Daniel.Sun



--
View this message in context: 
http://groovy.329449.n5.nabble.com/Http-Builder-NG-tp5736876p5736879.html
Sent from the Groovy Users mailing list archive at Nabble.com.


Re: ConcurrentModificationException with use of memoize

2016-11-17 Thread Daniel Sun
Hi Don,

  I assume that it may be related to the cache based on
Collections.synchronizedMap, the implementation is refined via using
ConcurrentLinkedHashMap on parrot branch. Could you give it a try by
following the steps?

$ git clone -b parrot https://github.com/apache/groovy.git
$ cd groovy
$ gradlew -PuseAntlr4=true jarAllAll
( then you can find the "groovy-all-2.5.0-SNAPSHOT.jar" file under directory
target/libs )

 Good luck :)

Cheers,
Daniel.Sun



--
View this message in context: 
http://groovy.329449.n5.nabble.com/ConcurrentModificationException-with-use-of-memoize-tp5736788p5736805.html
Sent from the Groovy Users mailing list archive at Nabble.com.


Re: Congratulations to our newest committer Daniel Sun

2016-11-14 Thread Daniel Sun
Thank you, everybody :)

Cheers,
Daniel.Sun



--
View this message in context: 
http://groovy.329449.n5.nabble.com/Congratulations-to-our-newest-committer-Daniel-Sun-tp5736468p5736738.html
Sent from the Groovy Users mailing list archive at Nabble.com.