[jira] [Commented] (GROOVY-9528) CLIBuilder: "error: Missing required options" when unknown options are provided

2020-04-27 Thread Dirk Heinrichs (Jira)


[ 
https://issues.apache.org/jira/browse/GROOVY-9528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17094165#comment-17094165
 ] 

Dirk Heinrichs commented on GROOVY-9528:


Depends on whether you consider non-deterministic behaviour if 
"stopAtNonOption: true" a bug or not.

> CLIBuilder: "error: Missing required options" when unknown options are 
> provided
> ---
>
> Key: GROOVY-9528
> URL: https://issues.apache.org/jira/browse/GROOVY-9528
> Project: Groovy
>  Issue Type: Bug
>  Components: command line processing
>Affects Versions: 3.0.2
> Environment: Linux/Windows
>Reporter: Dirk Heinrichs
>Priority: Major
>
> When passing an additional option to a script that doesn't know about this 
> option, I get an error message about "missing required options", listing all 
> required options that follow the unkown option.
> The following example code reproduces the issue:
> {code:java}
> @Grab('info.picocli:picocli-groovy:4.2.0')
> @GrabConfig(systemClassLoader=true)
> import groovy.cli.picocli.CliBuilder
> def cli = new CliBuilder(name: 'cliTest.groovy')
> cli.h(type: Boolean, longOpt: 'help', usageHelp: true, required: false, 'Show 
> usage information')
> cli.a(type: String, longOpt: 'optA', required: true, args: 1, 'Option a 
> (required)')
> cli.b(type: String, longOpt: 'optB', required: true, args: 1, 'Option b 
> (required)')
> // NOTE: No "-c|--optC" here
> cli.d(type: String, longOpt: 'optD', required: true, args: 1, 'Option d 
> (required)')
> cli.e(type: String, longOpt: 'optE', required: true, args: 1, 'Option e 
> (required)')
> cli.f(type: String, longOpt: 'optF', required: false, args: 1, 'Option f 
> (optional)')
> def opts = cli.parse(args)
> opts || System.exit(1)
> if(opts.h) {
>   cli.usage()
>   System.exit(0)
> }{code}
> When invoked with an additional option, '-c C' for example, it produces the 
> following, misleading output:
> {code:java}
> % ~/tmp/groovy-3.0.2/bin/groovy ./cliTest.groovy -a A -b B -c C -d D -e E
> error: Missing required options [--optD=PARAM, --optE=PARAM]
> Usage: cliTest.groovy [-h] -a=PARAM -b=PARAM -d=PARAM -e=PARAM [-f=PARAM]
>   -a, --optA=PARAM   Option a (required)
>   -b, --optB=PARAM   Option b (required)
>   -d, --optD=PARAM   Option d (required)
>   -e, --optE=PARAM   Option e (required)
>   -f, --optF=PARAM   Option f (optional)
>   -h, --help Show usage information{code}
> The list of missing options varies depending on where "-c C" is inserted. 
> There's no error when it's the last one.
> I would expect it to either ignore the addtional option in all cases or emit 
> an error message about an unknown option. But in no case should it error out 
> because of missing required options when there are none missing.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [groovy] mojo2012 commented on pull request #1236: [GROOVY-9364] Added "final var" shortcut keywords "let" and "val"

2020-04-27 Thread GitBox


mojo2012 commented on pull request #1236:
URL: https://github.com/apache/groovy/pull/1236#issuecomment-620386906


   When initializing a lot of variables it is way more readable to have them 
properly aligned like this:
   
   ```groovy
   var testObject = ...
   val webClient = ...
   var nextObject = ...
   ```
   
   instead of:
   ```
   groovy
   var testObject = ...
   final var webClient = ...
   var nextObject = ...
   ```
   
   I remember mentioning Brian Goetz that as one of the main reasons that make 
`var` so nice to use.
   
   Obviously none uses final variables these days anymore, or why did the java 
team not think about that :-D



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [groovy] danielsun1106 commented on pull request #1236: [GROOVY-9364] Added "final var" shortcut keywords "let" and "val"

2020-04-27 Thread GitBox


danielsun1106 commented on pull request #1236:
URL: https://github.com/apache/groovy/pull/1236#issuecomment-620316066


   Out of curiosity, why do we need two similar new keywords `val` and `let`?



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[jira] [Resolved] (GROOVY-9526) Failed to reload classes with generic parameters

2020-04-27 Thread Daniel Sun (Jira)


 [ 
https://issues.apache.org/jira/browse/GROOVY-9526?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Sun resolved GROOVY-9526.

Resolution: Fixed

> Failed to reload classes with generic parameters
> 
>
> Key: GROOVY-9526
> URL: https://issues.apache.org/jira/browse/GROOVY-9526
> Project: Groovy
>  Issue Type: Bug
>  Components: GroovyScriptEngine
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 4.0.0-alpha-1, 3.0.4
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> See [https://github.com/apache/groovy/pull/1168]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (GROOVY-9528) CLIBuilder: "error: Missing required options" when unknown options are provided

2020-04-27 Thread Remko Popma (Jira)


[ 
https://issues.apache.org/jira/browse/GROOVY-9528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17093994#comment-17093994
 ] 

Remko Popma commented on GROOVY-9528:
-

Thank you [~paulk]!

[~dheinric], is any further action required on this ticket?

> CLIBuilder: "error: Missing required options" when unknown options are 
> provided
> ---
>
> Key: GROOVY-9528
> URL: https://issues.apache.org/jira/browse/GROOVY-9528
> Project: Groovy
>  Issue Type: Bug
>  Components: command line processing
>Affects Versions: 3.0.2
> Environment: Linux/Windows
>Reporter: Dirk Heinrichs
>Priority: Major
>
> When passing an additional option to a script that doesn't know about this 
> option, I get an error message about "missing required options", listing all 
> required options that follow the unkown option.
> The following example code reproduces the issue:
> {code:java}
> @Grab('info.picocli:picocli-groovy:4.2.0')
> @GrabConfig(systemClassLoader=true)
> import groovy.cli.picocli.CliBuilder
> def cli = new CliBuilder(name: 'cliTest.groovy')
> cli.h(type: Boolean, longOpt: 'help', usageHelp: true, required: false, 'Show 
> usage information')
> cli.a(type: String, longOpt: 'optA', required: true, args: 1, 'Option a 
> (required)')
> cli.b(type: String, longOpt: 'optB', required: true, args: 1, 'Option b 
> (required)')
> // NOTE: No "-c|--optC" here
> cli.d(type: String, longOpt: 'optD', required: true, args: 1, 'Option d 
> (required)')
> cli.e(type: String, longOpt: 'optE', required: true, args: 1, 'Option e 
> (required)')
> cli.f(type: String, longOpt: 'optF', required: false, args: 1, 'Option f 
> (optional)')
> def opts = cli.parse(args)
> opts || System.exit(1)
> if(opts.h) {
>   cli.usage()
>   System.exit(0)
> }{code}
> When invoked with an additional option, '-c C' for example, it produces the 
> following, misleading output:
> {code:java}
> % ~/tmp/groovy-3.0.2/bin/groovy ./cliTest.groovy -a A -b B -c C -d D -e E
> error: Missing required options [--optD=PARAM, --optE=PARAM]
> Usage: cliTest.groovy [-h] -a=PARAM -b=PARAM -d=PARAM -e=PARAM [-f=PARAM]
>   -a, --optA=PARAM   Option a (required)
>   -b, --optB=PARAM   Option b (required)
>   -d, --optD=PARAM   Option d (required)
>   -e, --optE=PARAM   Option e (required)
>   -f, --optF=PARAM   Option f (optional)
>   -h, --help Show usage information{code}
> The list of missing options varies depending on where "-c C" is inserted. 
> There's no error when it's the last one.
> I would expect it to either ignore the addtional option in all cases or emit 
> an error message about an unknown option. But in no case should it error out 
> because of missing required options when there are none missing.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [groovy] paulk-asert commented on pull request #1236: [GROOVY-9364] Added "final var" shortcut keywords "let" and "val"

2020-04-27 Thread GitBox


paulk-asert commented on pull request #1236:
URL: https://github.com/apache/groovy/pull/1236#issuecomment-620267220


   Relates to GROOVY-9308



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [groovy] mojo2012 opened a new pull request #1236: [GROOVY-9364] Added "final var" shortcut keywords "let" and "val"

2020-04-27 Thread GitBox


mojo2012 opened a new pull request #1236:
URL: https://github.com/apache/groovy/pull/1236


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[jira] [Commented] (GROOVY-9308) [Parrot] support let or val keyword, aka "final var"

2020-04-27 Thread Matthias Fuchs (Jira)


[ 
https://issues.apache.org/jira/browse/GROOVY-9308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17093872#comment-17093872
 ] 

Matthias Fuchs commented on GROOVY-9308:


I implemented bot "let" and "val" in this repo: 
[https://github.com/mojo2012/groovy]

I also added tests (similar to the "var" and "def" keyword. But unfortunately I 
didn't manage to make "final val" or "final let" invalid. 

Maybe someone of you can point me in the right direction?

 

Anyway, I don't know if including both keywords is a good idea, but as both 
kotlin and scala went with the "val" keyword, I guess it's best to go for this 
as well.

Let me know if you are interested in this feature.

> [Parrot] support let or val keyword, aka "final var"
> 
>
> Key: GROOVY-9308
> URL: https://issues.apache.org/jira/browse/GROOVY-9308
> Project: Groovy
>  Issue Type: Wish
>Reporter: Matthias Fuchs
>Priority: Minor
>
> I'm a long time java developer and I'm used to add "final" to my variable 
> definition: final var name = "a"
> I think the "var" keyword itself helps a lot, but seeing "var" and "final 
> var" not being alligned properly in code makes me crazy ;)
> As we have *def* and *var* in groovy, wouldn't it be nice to have a *val* or 
> *let* in groovy too, that is just a short form of "*final var*"?
> Although personally I would prefer "val" I do understand that some people 
> might have problems differentiating "var" and "val", hence the "let".
> Imagine:
> {code:java}
> var destination = "Wien"
> val country = "AT"{code}
> instead of:
> {code:java}
> var destination = "Wien"
> final var country = "AT"{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Created] (GROOVY-9529) Static type checking сannot choose between Map#getAt(Object) and Object#getAt(String) methods

2020-04-27 Thread Aleksey (Jira)
Aleksey created GROOVY-9529:
---

 Summary: Static type checking сannot choose between 
Map#getAt(Object) and Object#getAt(String) methods
 Key: GROOVY-9529
 URL: https://issues.apache.org/jira/browse/GROOVY-9529
 Project: Groovy
  Issue Type: Bug
  Components: Static compilation
Affects Versions: 3.0.3
 Environment: Groovy Version: 3.0.3 JVM: 11.0.7 Vendor: Azul Systems, 
Inc. OS: Linux
Reporter: Aleksey


Script:
{code:groovy}
import groovy.transform.CompileStatic

interface SimpleFeatureMap extends Map {}
interface FeatureMap extends SimpleFeatureMap{}
class FeatureMapImpl extends HashMap implements FeatureMap {}

@CompileStatic
class Test {
FeatureMap newMap() {
new FeatureMapImpl()
}
String test() {
FeatureMap map = newMap()
map['asd']
}
}

new Test().test()
{code}

Result:
{noformat}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
ideaGroovyConsole.groovy: 14: [Static type checking] - Reference to method is 
ambiguous. Cannot choose between [V java.util.Map #getAt(java.lang.Object), java.lang.Object 
java.lang.Object#getAt(java.lang.String)]
 @ line 14, column 9.
   map['asd']
   ^

1 error

at 
org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:287)
at 
org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:963)
at 
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:650)
at 
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:627)
at 
groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:389)
at 
groovy.lang.GroovyClassLoader.lambda$parseClass$3(GroovyClassLoader.java:332)
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:330)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:526)
at groovy.lang.GroovyShell.run(GroovyShell.java:359)
at groovy.lang.GroovyShell.run(GroovyShell.java:339)
{noformat}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [groovy] blackdrag commented on pull request #1234: enable Log4J tests bye ensuring indy is really enabled by default.

2020-04-27 Thread GitBox


blackdrag commented on pull request #1234:
URL: https://github.com/apache/groovy/pull/1234#issuecomment-620073274


   yes, I was wondering why you merged it... but the failures look like they 
are exposing problems with indy and related to method selection



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[jira] [Commented] (GROOVY-9528) CLIBuilder: "error: Missing required options" when unknown options are provided

2020-04-27 Thread Dirk Heinrichs (Jira)


[ 
https://issues.apache.org/jira/browse/GROOVY-9528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17093542#comment-17093542
 ] 

Dirk Heinrichs commented on GROOVY-9528:


Forget about the last sentence. Found it.

> CLIBuilder: "error: Missing required options" when unknown options are 
> provided
> ---
>
> Key: GROOVY-9528
> URL: https://issues.apache.org/jira/browse/GROOVY-9528
> Project: Groovy
>  Issue Type: Bug
>  Components: command line processing
>Affects Versions: 3.0.2
> Environment: Linux/Windows
>Reporter: Dirk Heinrichs
>Priority: Major
>
> When passing an additional option to a script that doesn't know about this 
> option, I get an error message about "missing required options", listing all 
> required options that follow the unkown option.
> The following example code reproduces the issue:
> {code:java}
> @Grab('info.picocli:picocli-groovy:4.2.0')
> @GrabConfig(systemClassLoader=true)
> import groovy.cli.picocli.CliBuilder
> def cli = new CliBuilder(name: 'cliTest.groovy')
> cli.h(type: Boolean, longOpt: 'help', usageHelp: true, required: false, 'Show 
> usage information')
> cli.a(type: String, longOpt: 'optA', required: true, args: 1, 'Option a 
> (required)')
> cli.b(type: String, longOpt: 'optB', required: true, args: 1, 'Option b 
> (required)')
> // NOTE: No "-c|--optC" here
> cli.d(type: String, longOpt: 'optD', required: true, args: 1, 'Option d 
> (required)')
> cli.e(type: String, longOpt: 'optE', required: true, args: 1, 'Option e 
> (required)')
> cli.f(type: String, longOpt: 'optF', required: false, args: 1, 'Option f 
> (optional)')
> def opts = cli.parse(args)
> opts || System.exit(1)
> if(opts.h) {
>   cli.usage()
>   System.exit(0)
> }{code}
> When invoked with an additional option, '-c C' for example, it produces the 
> following, misleading output:
> {code:java}
> % ~/tmp/groovy-3.0.2/bin/groovy ./cliTest.groovy -a A -b B -c C -d D -e E
> error: Missing required options [--optD=PARAM, --optE=PARAM]
> Usage: cliTest.groovy [-h] -a=PARAM -b=PARAM -d=PARAM -e=PARAM [-f=PARAM]
>   -a, --optA=PARAM   Option a (required)
>   -b, --optB=PARAM   Option b (required)
>   -d, --optD=PARAM   Option d (required)
>   -e, --optE=PARAM   Option e (required)
>   -f, --optF=PARAM   Option f (optional)
>   -h, --help Show usage information{code}
> The list of missing options varies depending on where "-c C" is inserted. 
> There's no error when it's the last one.
> I would expect it to either ignore the addtional option in all cases or emit 
> an error message about an unknown option. But in no case should it error out 
> because of missing required options when there are none missing.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Comment Edited] (GROOVY-9528) CLIBuilder: "error: Missing required options" when unknown options are provided

2020-04-27 Thread Dirk Heinrichs (Jira)


[ 
https://issues.apache.org/jira/browse/GROOVY-9528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17093535#comment-17093535
 ] 

Dirk Heinrichs edited comment on GROOVY-9528 at 4/27/20, 1:56 PM:
--

Indeed. Wouldn't this be worth mentioning in the documentation? Even the API 
documentation only mentions one contructor: CliBuilder().


was (Author: dheinric):
Indeed. Wouldn't this be worth mentioning in the documentation?

> CLIBuilder: "error: Missing required options" when unknown options are 
> provided
> ---
>
> Key: GROOVY-9528
> URL: https://issues.apache.org/jira/browse/GROOVY-9528
> Project: Groovy
>  Issue Type: Bug
>  Components: command line processing
>Affects Versions: 3.0.2
> Environment: Linux/Windows
>Reporter: Dirk Heinrichs
>Priority: Major
>
> When passing an additional option to a script that doesn't know about this 
> option, I get an error message about "missing required options", listing all 
> required options that follow the unkown option.
> The following example code reproduces the issue:
> {code:java}
> @Grab('info.picocli:picocli-groovy:4.2.0')
> @GrabConfig(systemClassLoader=true)
> import groovy.cli.picocli.CliBuilder
> def cli = new CliBuilder(name: 'cliTest.groovy')
> cli.h(type: Boolean, longOpt: 'help', usageHelp: true, required: false, 'Show 
> usage information')
> cli.a(type: String, longOpt: 'optA', required: true, args: 1, 'Option a 
> (required)')
> cli.b(type: String, longOpt: 'optB', required: true, args: 1, 'Option b 
> (required)')
> // NOTE: No "-c|--optC" here
> cli.d(type: String, longOpt: 'optD', required: true, args: 1, 'Option d 
> (required)')
> cli.e(type: String, longOpt: 'optE', required: true, args: 1, 'Option e 
> (required)')
> cli.f(type: String, longOpt: 'optF', required: false, args: 1, 'Option f 
> (optional)')
> def opts = cli.parse(args)
> opts || System.exit(1)
> if(opts.h) {
>   cli.usage()
>   System.exit(0)
> }{code}
> When invoked with an additional option, '-c C' for example, it produces the 
> following, misleading output:
> {code:java}
> % ~/tmp/groovy-3.0.2/bin/groovy ./cliTest.groovy -a A -b B -c C -d D -e E
> error: Missing required options [--optD=PARAM, --optE=PARAM]
> Usage: cliTest.groovy [-h] -a=PARAM -b=PARAM -d=PARAM -e=PARAM [-f=PARAM]
>   -a, --optA=PARAM   Option a (required)
>   -b, --optB=PARAM   Option b (required)
>   -d, --optD=PARAM   Option d (required)
>   -e, --optE=PARAM   Option e (required)
>   -f, --optF=PARAM   Option f (optional)
>   -h, --help Show usage information{code}
> The list of missing options varies depending on where "-c C" is inserted. 
> There's no error when it's the last one.
> I would expect it to either ignore the addtional option in all cases or emit 
> an error message about an unknown option. But in no case should it error out 
> because of missing required options when there are none missing.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (GROOVY-9528) CLIBuilder: "error: Missing required options" when unknown options are provided

2020-04-27 Thread Dirk Heinrichs (Jira)


[ 
https://issues.apache.org/jira/browse/GROOVY-9528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17093535#comment-17093535
 ] 

Dirk Heinrichs commented on GROOVY-9528:


Indeed. Wouldn't this be worth mentioning in the documentation?

> CLIBuilder: "error: Missing required options" when unknown options are 
> provided
> ---
>
> Key: GROOVY-9528
> URL: https://issues.apache.org/jira/browse/GROOVY-9528
> Project: Groovy
>  Issue Type: Bug
>  Components: command line processing
>Affects Versions: 3.0.2
> Environment: Linux/Windows
>Reporter: Dirk Heinrichs
>Priority: Major
>
> When passing an additional option to a script that doesn't know about this 
> option, I get an error message about "missing required options", listing all 
> required options that follow the unkown option.
> The following example code reproduces the issue:
> {code:java}
> @Grab('info.picocli:picocli-groovy:4.2.0')
> @GrabConfig(systemClassLoader=true)
> import groovy.cli.picocli.CliBuilder
> def cli = new CliBuilder(name: 'cliTest.groovy')
> cli.h(type: Boolean, longOpt: 'help', usageHelp: true, required: false, 'Show 
> usage information')
> cli.a(type: String, longOpt: 'optA', required: true, args: 1, 'Option a 
> (required)')
> cli.b(type: String, longOpt: 'optB', required: true, args: 1, 'Option b 
> (required)')
> // NOTE: No "-c|--optC" here
> cli.d(type: String, longOpt: 'optD', required: true, args: 1, 'Option d 
> (required)')
> cli.e(type: String, longOpt: 'optE', required: true, args: 1, 'Option e 
> (required)')
> cli.f(type: String, longOpt: 'optF', required: false, args: 1, 'Option f 
> (optional)')
> def opts = cli.parse(args)
> opts || System.exit(1)
> if(opts.h) {
>   cli.usage()
>   System.exit(0)
> }{code}
> When invoked with an additional option, '-c C' for example, it produces the 
> following, misleading output:
> {code:java}
> % ~/tmp/groovy-3.0.2/bin/groovy ./cliTest.groovy -a A -b B -c C -d D -e E
> error: Missing required options [--optD=PARAM, --optE=PARAM]
> Usage: cliTest.groovy [-h] -a=PARAM -b=PARAM -d=PARAM -e=PARAM [-f=PARAM]
>   -a, --optA=PARAM   Option a (required)
>   -b, --optB=PARAM   Option b (required)
>   -d, --optD=PARAM   Option d (required)
>   -e, --optE=PARAM   Option e (required)
>   -f, --optF=PARAM   Option f (optional)
>   -h, --help Show usage information{code}
> The list of missing options varies depending on where "-c C" is inserted. 
> There's no error when it's the last one.
> I would expect it to either ignore the addtional option in all cases or emit 
> an error message about an unknown option. But in no case should it error out 
> because of missing required options when there are none missing.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (GROOVY-9528) CLIBuilder: "error: Missing required options" when unknown options are provided

2020-04-27 Thread Paul King (Jira)


[ 
https://issues.apache.org/jira/browse/GROOVY-9528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17093528#comment-17093528
 ] 

Paul King commented on GROOVY-9528:
---

If you change your constructor call to be:
{code:groovy}
def cli = new CliBuilder(name: 'cliTest.groovy', stopAtNonOption: false)
{code}
then the error would be:
{noformat}
error: Unknown option: '-c'
{noformat}

> CLIBuilder: "error: Missing required options" when unknown options are 
> provided
> ---
>
> Key: GROOVY-9528
> URL: https://issues.apache.org/jira/browse/GROOVY-9528
> Project: Groovy
>  Issue Type: Bug
>  Components: command line processing
>Affects Versions: 3.0.2
> Environment: Linux/Windows
>Reporter: Dirk Heinrichs
>Priority: Major
>
> When passing an additional option to a script that doesn't know about this 
> option, I get an error message about "missing required options", listing all 
> required options that follow the unkown option.
> The following example code reproduces the issue:
> {code:java}
> @Grab('info.picocli:picocli-groovy:4.2.0')
> @GrabConfig(systemClassLoader=true)
> import groovy.cli.picocli.CliBuilder
> def cli = new CliBuilder(name: 'cliTest.groovy')
> cli.h(type: Boolean, longOpt: 'help', usageHelp: true, required: false, 'Show 
> usage information')
> cli.a(type: String, longOpt: 'optA', required: true, args: 1, 'Option a 
> (required)')
> cli.b(type: String, longOpt: 'optB', required: true, args: 1, 'Option b 
> (required)')
> // NOTE: No "-c|--optC" here
> cli.d(type: String, longOpt: 'optD', required: true, args: 1, 'Option d 
> (required)')
> cli.e(type: String, longOpt: 'optE', required: true, args: 1, 'Option e 
> (required)')
> cli.f(type: String, longOpt: 'optF', required: false, args: 1, 'Option f 
> (optional)')
> def opts = cli.parse(args)
> opts || System.exit(1)
> if(opts.h) {
>   cli.usage()
>   System.exit(0)
> }{code}
> When invoked with an additional option, '-c C' for example, it produces the 
> following, misleading output:
> {code:java}
> % ~/tmp/groovy-3.0.2/bin/groovy ./cliTest.groovy -a A -b B -c C -d D -e E
> error: Missing required options [--optD=PARAM, --optE=PARAM]
> Usage: cliTest.groovy [-h] -a=PARAM -b=PARAM -d=PARAM -e=PARAM [-f=PARAM]
>   -a, --optA=PARAM   Option a (required)
>   -b, --optB=PARAM   Option b (required)
>   -d, --optD=PARAM   Option d (required)
>   -e, --optE=PARAM   Option e (required)
>   -f, --optF=PARAM   Option f (optional)
>   -h, --help Show usage information{code}
> The list of missing options varies depending on where "-c C" is inserted. 
> There's no error when it's the last one.
> I would expect it to either ignore the addtional option in all cases or emit 
> an error message about an unknown option. But in no case should it error out 
> because of missing required options when there are none missing.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (GROOVY-9528) CLIBuilder: "error: Missing required options" when unknown options are provided

2020-04-27 Thread Dirk Heinrichs (Jira)


 [ 
https://issues.apache.org/jira/browse/GROOVY-9528?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dirk Heinrichs updated GROOVY-9528:
---
External issue URL: https://github.com/remkop/picocli/issues/1013
   Environment: Linux/Windows

> CLIBuilder: "error: Missing required options" when unknown options are 
> provided
> ---
>
> Key: GROOVY-9528
> URL: https://issues.apache.org/jira/browse/GROOVY-9528
> Project: Groovy
>  Issue Type: Bug
>  Components: command line processing
>Affects Versions: 3.0.2
> Environment: Linux/Windows
>Reporter: Dirk Heinrichs
>Priority: Major
>
> When passing an additional option to a script that doesn't know about this 
> option, I get an error message about "missing required options", listing all 
> required options that follow the unkown option.
> The following example code reproduces the issue:
> {code:java}
> @Grab('info.picocli:picocli-groovy:4.2.0')
> @GrabConfig(systemClassLoader=true)
> import groovy.cli.picocli.CliBuilder
> def cli = new CliBuilder(name: 'cliTest.groovy')
> cli.h(type: Boolean, longOpt: 'help', usageHelp: true, required: false, 'Show 
> usage information')
> cli.a(type: String, longOpt: 'optA', required: true, args: 1, 'Option a 
> (required)')
> cli.b(type: String, longOpt: 'optB', required: true, args: 1, 'Option b 
> (required)')
> // NOTE: No "-c|--optC" here
> cli.d(type: String, longOpt: 'optD', required: true, args: 1, 'Option d 
> (required)')
> cli.e(type: String, longOpt: 'optE', required: true, args: 1, 'Option e 
> (required)')
> cli.f(type: String, longOpt: 'optF', required: false, args: 1, 'Option f 
> (optional)')
> def opts = cli.parse(args)
> opts || System.exit(1)
> if(opts.h) {
>   cli.usage()
>   System.exit(0)
> }{code}
> When invoked with an additional option, '-c C' for example, it produces the 
> following, misleading output:
> {code:java}
> % ~/tmp/groovy-3.0.2/bin/groovy ./cliTest.groovy -a A -b B -c C -d D -e E
> error: Missing required options [--optD=PARAM, --optE=PARAM]
> Usage: cliTest.groovy [-h] -a=PARAM -b=PARAM -d=PARAM -e=PARAM [-f=PARAM]
>   -a, --optA=PARAM   Option a (required)
>   -b, --optB=PARAM   Option b (required)
>   -d, --optD=PARAM   Option d (required)
>   -e, --optE=PARAM   Option e (required)
>   -f, --optF=PARAM   Option f (optional)
>   -h, --help Show usage information{code}
> The list of missing options varies depending on where "-c C" is inserted. 
> There's no error when it's the last one.
> I would expect it to either ignore the addtional option in all cases or emit 
> an error message about an unknown option. But in no case should it error out 
> because of missing required options when there are none missing.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Created] (GROOVY-9528) CLIBuilder: "error: Missing required options" when unknown options are provided

2020-04-27 Thread Dirk Heinrichs (Jira)
Dirk Heinrichs created GROOVY-9528:
--

 Summary: CLIBuilder: "error: Missing required options" when 
unknown options are provided
 Key: GROOVY-9528
 URL: https://issues.apache.org/jira/browse/GROOVY-9528
 Project: Groovy
  Issue Type: Bug
  Components: command line processing
Affects Versions: 3.0.2
Reporter: Dirk Heinrichs


When passing an additional option to a script that doesn't know about this 
option, I get an error message about "missing required options", listing all 
required options that follow the unkown option.

The following example code reproduces the issue:
{code:java}
@Grab('info.picocli:picocli-groovy:4.2.0')
@GrabConfig(systemClassLoader=true)

import groovy.cli.picocli.CliBuilder

def cli = new CliBuilder(name: 'cliTest.groovy')
cli.h(type: Boolean, longOpt: 'help', usageHelp: true, required: false, 'Show 
usage information')
cli.a(type: String, longOpt: 'optA', required: true, args: 1, 'Option a 
(required)')
cli.b(type: String, longOpt: 'optB', required: true, args: 1, 'Option b 
(required)')
// NOTE: No "-c|--optC" here
cli.d(type: String, longOpt: 'optD', required: true, args: 1, 'Option d 
(required)')
cli.e(type: String, longOpt: 'optE', required: true, args: 1, 'Option e 
(required)')
cli.f(type: String, longOpt: 'optF', required: false, args: 1, 'Option f 
(optional)')
def opts = cli.parse(args)
opts || System.exit(1)
if(opts.h) {
  cli.usage()
  System.exit(0)
}{code}
When invoked with an additional option, '-c C' for example, it produces the 
following, misleading output:
{code:java}
% ~/tmp/groovy-3.0.2/bin/groovy ./cliTest.groovy -a A -b B -c C -d D -e E
error: Missing required options [--optD=PARAM, --optE=PARAM]
Usage: cliTest.groovy [-h] -a=PARAM -b=PARAM -d=PARAM -e=PARAM [-f=PARAM]
  -a, --optA=PARAM   Option a (required)
  -b, --optB=PARAM   Option b (required)
  -d, --optD=PARAM   Option d (required)
  -e, --optE=PARAM   Option e (required)
  -f, --optF=PARAM   Option f (optional)
  -h, --help Show usage information{code}
The list of missing options varies depending on where "-c C" is inserted. 
There's no error when it's the last one.

I would expect it to either ignore the addtional option in all cases or emit an 
error message about an unknown option. But in no case should it error out 
because of missing required options when there are none missing.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [groovy] paulk-asert commented on pull request #1234: enable Log4J tests bye ensuring indy is really enabled by default.

2020-04-27 Thread GitBox


paulk-asert commented on pull request #1234:
URL: https://github.com/apache/groovy/pull/1234#issuecomment-619968830


   I merged because I thought it passed locally but I must have been mistaken. 
It just broke the build quite badly - so I have reverted for now.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[jira] [Commented] (GROOVY-9519) CLIBuilder: Option with "type: Integer, defaultValue '0'" results in Boolean if default value is applied

2020-04-27 Thread Dirk Heinrichs (Jira)


[ 
https://issues.apache.org/jira/browse/GROOVY-9519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17093480#comment-17093480
 ] 

Dirk Heinrichs commented on GROOVY-9519:


BTW: It also happens with
{noformat}
..., type: String, defaultValue: '', ...{noformat}

> CLIBuilder: Option with "type: Integer, defaultValue '0'" results in Boolean 
> if default value is applied
> 
>
> Key: GROOVY-9519
> URL: https://issues.apache.org/jira/browse/GROOVY-9519
> Project: Groovy
>  Issue Type: Bug
>  Components: command line processing
>Affects Versions: 3.0.2
> Environment: WIndows/Linux
>Reporter: Dirk Heinrichs
>Priority: Major
>
> When using an option with {{type: Integer}} and {{defaultValue: '0'}} the 
> resulting variable is of type Boolean if the option is not specified on the 
> command line. Here's a little Groovy program to demonstrate the issue:
> {code:java}
> @Grab('info.picocli:picocli-groovy:4.2.0')
> @GrabConfig(systemClassLoader=true)
> import groovy.cli.picocli.CliBuilder
> def cli = new CliBuilder(name: 'cliTest.groovy')
> cli.h(type: Boolean, longOpt: 'help', usageHelp: true, required: false, 'Show 
> usage information')
> cli.i(type: Integer, longOpt: 'intTest', required: false, args: 1, 
> defaultValue: '0', 'Testing integer with default value 0')
> def opts = cli.parse(args)
> opts || System.exit(1)
> if(opts.h) {
>   cli.usage()
>   System.exit(0)
> }
> println(opts.i.getClass())
> println(opts.i)
> // Need to explicitely convert if default value applies
> def i = (opts.i instanceof Boolean ? 0 : opts.i)
> println(i.getClass())
> println(i){code}
> Executing this w/o providing {{-i}} prints:
> {code}% ~/tmp/groovy-3.0.2/bin/groovy ./cliTest.groovy 
> class java.lang.Boolean
> false
> class java.lang.Integer
> 0{code}
> But if {{-i}} IS provided (even with the same value as the default), it 
> correctly prints:
> {code}% ~/tmp/groovy-3.0.2/bin/groovy ./cliTest.groovy -i 0
> class java.lang.Integer
> 0
> class java.lang.Integer
> 0{code}
> I would expect the type of {{opts.i}} to be Integer in both cases.
> NOTE: I've opened the same for PicoCLI, since I wasn't sure where it belongs.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Resolved] (GROOVY-9520) Update Spotbugs/Spotbugs plugin to 4.0.2/4.0.5

2020-04-27 Thread Paul King (Jira)


 [ 
https://issues.apache.org/jira/browse/GROOVY-9520?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King resolved GROOVY-9520.
---
Fix Version/s: 3.0.4
   4.0.0-alpha-1
   Resolution: Fixed

> Update Spotbugs/Spotbugs plugin to 4.0.2/4.0.5
> --
>
> Key: GROOVY-9520
> URL: https://issues.apache.org/jira/browse/GROOVY-9520
> Project: Groovy
>  Issue Type: Dependency upgrade
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
> Fix For: 4.0.0-alpha-1, 3.0.4
>
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)