[jira] [Commented] (GROOVY-9310) Groovy does not ignore second bash directive
[ https://issues.apache.org/jira/browse/GROOVY-9310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17064481#comment-17064481 ] John Mercier commented on GROOVY-9310: -- Thanks for the help. I worked on this for a few hours this weekend and this pull request is what I came up with https://github.com/apache/groovy/pull/1203. I'm not sure how contributing to groovy works but if there is anything else I can do let me know. > Groovy does not ignore second bash directive > > > Key: GROOVY-9310 > URL: https://issues.apache.org/jira/browse/GROOVY-9310 > Project: Groovy > Issue Type: Bug > Components: command line processing >Reporter: John Mercier >Priority: Major > > When creating a groovy script for nixos I ran into an issue. Here is the > script. > > {code:java} > #! /usr/bin/env nix-shell > #! nix-shell -i groovy -p groovy > println "hello" > {code} > The script uses a second bash directive which tells nix-shell to run the > script using groovy. Groovy gives the following error. > > {code:java} > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > /home/john/projects/netbeans/update-nix-dependencies.groovy: 2: unexpected > char: '#' @ line 2, column 1. >#! nix-shell -i groovy -p groovy >^ > 1 error > {code} > This seems to be a groovy issue and I was wondering how it could be fixed. > There is a workaround for nix-shell described > [here|https://discourse.nixos.org/t/how-to-use-nix-shell-with-groovy/4779/2?u=moaxcp]. > I'm willing to submit a pull request for this but I'm not sure where to > start. Thanks! -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Created] (GROOVY-9310) Groovy does not ignore second bash directive
John Mercier created GROOVY-9310: Summary: Groovy does not ignore second bash directive Key: GROOVY-9310 URL: https://issues.apache.org/jira/browse/GROOVY-9310 Project: Groovy Issue Type: Bug Components: command line processing Reporter: John Mercier When creating a groovy script for nixos I ran into an issue. Here is the script. {code:java} #! /usr/bin/env nix-shell #! nix-shell -i groovy -p groovy println "hello" {code} The script uses a second bash directive which tells nix-shell to run the script using groovy. Groovy gives the following error. {code:java} org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: /home/john/projects/netbeans/update-nix-dependencies.groovy: 2: unexpected char: '#' @ line 2, column 1. #! nix-shell -i groovy -p groovy ^ 1 error {code} This seems to be a groovy issue and I was wondering how it could be fixed. There is a workaround for nix-shell described [here|https://discourse.nixos.org/t/how-to-use-nix-shell-with-groovy/4779/2?u=moaxcp]. I'm willing to submit a pull request for this but I'm not sure where to start. Thanks! -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (GROOVY-4610) GroovyInterceptable (AOP) not working with closures
[ https://issues.apache.org/jira/browse/GROOVY-4610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16184454#comment-16184454 ] John Mercier commented on GROOVY-4610: -- Is there a workaround for this issue? > GroovyInterceptable (AOP) not working with closures > --- > > Key: GROOVY-4610 > URL: https://issues.apache.org/jira/browse/GROOVY-4610 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime > Environment: JDK 1.6.x, Grails 1.2.1 >Reporter: Sunny Thandassery > > I've got a grails app with Service classes that inherit from Groovy's > GroovyInterceptable: > [code] > class customerSerrvice implements GroovyInterceptable { > private List customers > def invokeMethod(String name, args) { > log.debug "===>INVOKING method [$name] with args:$args" > } > void foo() { > customers.each { doSomething(it) } > } > void doSomething(Customer cust) { log.debug "doSomething invoked with > $cust" } > } > [/code] > If I call foo() or doSomething() **directly** from another class, the > invokeMethod gets called like it is supposed to. However, when foo() calls > doSomething(), that call is not intercepted in invokeMethod. > If I change from > `customers.each { doSomething(it) }` > to > `for(Customer cust: customers) { doSomething(cust) }` > then the invokeMethod gets called just fine. > There appears to be an ExpandoMetaClass bug that prevents closures and > GroovyInterceptable from working together. -- This message was sent by Atlassian JIRA (v6.4.14#64029)