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

ASF GitHub Bot commented on GROOVY-11987:
-----------------------------------------

paulk-asert opened a new pull request, #2511:
URL: https://github.com/apache/groovy/pull/2511

   …se" when --javaVersion omitted




> groovydoc CLI fails with "Unsupported Java Version: false" when --javaVersion 
> omitted
> -------------------------------------------------------------------------------------
>
>                 Key: GROOVY-11987
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11987
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 6.0.0-alpha-1
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>
> {code}
> $ groovydoc -d out -sourcepath src Foo.groovy
> java.lang.IllegalArgumentException: Unsupported Java Version: false
>     at 
> org.codehaus.groovy.tools.groovydoc.GroovyDocTool.calculateLanguageLevel(GroovyDocTool.java:128)
>     at 
> org.codehaus.groovy.tools.groovydoc.GroovyDocTool.<init>(GroovyDocTool.java:78)
>     at org.codehaus.groovy.tools.groovydoc.Main.execute(Main.groovy:284)
> {code}
> When the {{--javaVersion}} CLI option is omitted, {{groovydoc}} aborts with 
> {{IllegalArgumentException: Unsupported Java Version: false}} instead of 
> falling back to the running JVM's version.
> *Root cause:* in {{Main.groovy}} line 163, {{javaVersion = 
> options.javaVersion}} reads the picocli option without handling its 
> absent-value sentinel, so the literal string {{"false"}} is passed to 
> {{GroovyDocTool}}. In {{GroovyDocTool.calculateLanguageLevel}}, the {{null}} 
> check at line 113 never triggers (the value is non-null {{"false"}}), so the 
> code falls through to {{ParserConfiguration.LanguageLevel.valueOf("FALSE")}} 
> at line 126, which throws.
> *Expected:* with no {{--javaVersion}}, {{groovydoc}} should use the running 
> JVM's feature version (the existing fallback in the {{version == null}} 
> branch).
> *Workaround:* pass {{-javaVersion JAVA_17}} (or matching version) explicitly.
> *Affects:* 6.0.0-SNAPSHOT.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to