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

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

jdaugherty commented on code in PR #2228:
URL: https://github.com/apache/groovy/pull/2228#discussion_r2096098929


##########
subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java:
##########
@@ -1026,6 +1039,63 @@ public void testClassDeclarationHeader() throws 
Exception {
         assertTrue("The Groovy derived class declaration header should match 
in:\n" + groovyDerivedClass, derivedClass.matcher(groovyDerivedClass).find());
     }
 
+    public void testLanguageLevelNotSupported() throws Exception {
+        htmlTool = makeHtmltool(new ArrayList<LinkArgument>(), 
ParserConfiguration.LanguageLevel.JAVA_1_4.name(), new Properties());
+
+        final String base = 
"org/codehaus/groovy/tools/groovydoc/testfiles/generics";
+
+        PrintStream originalSystemErr = System.err;
+        ByteArrayOutputStream systemErr = new ByteArrayOutputStream();
+        try {
+            System.setErr(new PrintStream(systemErr));
+            htmlTool.add(Arrays.asList(
+                base + "/Java.java"
+            ));
+        }
+        finally {
+            System.setErr(originalSystemErr);
+        }
+        final String errorMessage = systemErr.toString();
+        System.err.println(errorMessage);

Review Comment:
   The groovy doc tool uses System.err when outputting, so this is how to 
capture that output.





> Groovydoc crashes with higher Java language levels
> --------------------------------------------------
>
>                 Key: GROOVY-11668
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11668
>             Project: Groovy
>          Issue Type: Improvement
>          Components: GroovyDoc
>            Reporter: James Daugherty
>            Priority: Critical
>
> Groovydoc supports both groovy & java files.  It supports parsing via the 
> JavaParser library & the library supports specifying a language level.  
> However, groovydoc does not have a way of setting it for the library at this 
> time.  By default the library defaults to the "popular" language level of 
> that release - for the current JavaParser version that is Java 11.  
> As projects update to newer language features, it is desirable to continue 
> using groovydoc for later Java versions.  This change is to add an option to 
> groovydoc to specify the language level based on the possible values in the 
> enum ParserConfiguration.LanguageLevel from the JavaParser library.



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

Reply via email to