Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
The following code runs in groovy 2 but not groovy 3
def cli = new CliBuilder(writer : new PrintWriter(System.out)) def opt = 'a' def key = 'abc' def type = double.class def desc = 'abc' cli."$opt"(args: 1, longOpt: key, type: type, desc) def options = cli.parse(['--abc', '0.00']) options.getOptions().each { assert(it.getType().toString() == 'double') }
groovy 3 output
Assertion failed: assert(it.getType().toString() == 'double') | | | | | | | false | | 'class java.lang.String' | class java.lang.String [ option: a abc [ARG] :: abc :: class java.lang.String ] at ConsoleScript26$_run_closure1.doCall(ConsoleScript26:9) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at ConsoleScript26.run(ConsoleScript26:8) at jdk.internal.reflect.GeneratedMethodAccessor61.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)