[groovy] 01/01: GROOVY-9522: Throwing NPE when I use ternary operator with something special
This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch GROOVY-9522 in repository https://gitbox.apache.org/repos/asf/groovy.git commit 534f99313d40131d02821ece711a97593d918ee6 Author: Daniel Sun AuthorDate: Tue May 12 08:03:23 2020 +0800 GROOVY-9522: Throwing NPE when I use ternary operator with something special --- src/antlr/GroovyParser.g4 | 36 -- .../groovy/parser/antlr4/GroovyParserTest.groovy | 4 +++ .../src/test/resources/bugs/BUG-GROOVY-9522.groovy | 32 +++ 3 files changed, 70 insertions(+), 2 deletions(-) diff --git a/src/antlr/GroovyParser.g4 b/src/antlr/GroovyParser.g4 index 29f347c..f564a8a 100644 --- a/src/antlr/GroovyParser.g4 +++ b/src/antlr/GroovyParser.g4 @@ -1008,6 +1008,13 @@ options { baseContext = primary; } | parExpression #parenPrmrAlt ; +namedArgPrimary +options { baseContext = primary; } +: identifier #identifierPrmrAlt +| literal #literalPrmrAlt +| gstring #gstringPrmrAlt +; + commandPrimary options { baseContext = primary; } : identifier #identifierPrmrAlt @@ -1047,6 +1054,12 @@ options { baseContext = mapEntry; } | MUL COLON nls expression ; +namedArg +options { baseContext = mapEntry; } +: namedArgLabel COLON nls expression +| MUL COLON nls expression +; + mapEntryLabel : keywords | primary @@ -1058,6 +1071,12 @@ options { baseContext = mapEntryLabel; } | namedPropertyArgPrimary ; +namedArgLabel +options { baseContext = mapEntryLabel; } +: keywords +| namedArgPrimary +; + /** * t 0: general creation; 1: non-static inner class creation */ @@ -1105,25 +1124,38 @@ arguments argumentList options { baseContext = enhancedArgumentList; } -: argumentListElement +: firstArgumentListElement ( COMMA nls argumentListElement )* ; enhancedArgumentList -: enhancedArgumentListElement +: firstEnhancedArgumentListElement ( COMMA nls enhancedArgumentListElement )* ; +firstArgumentListElement +options { baseContext = enhancedArgumentListElement; } +: expressionListElement[true] +| namedArg +; + argumentListElement options { baseContext = enhancedArgumentListElement; } : expressionListElement[true] | namedPropertyArg ; +firstEnhancedArgumentListElement +options { baseContext = enhancedArgumentListElement; } +: expressionListElement[true] +| standardLambdaExpression +| namedArg +; + enhancedArgumentListElement : expressionListElement[true] | standardLambdaExpression diff --git a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy index cf841e5..83e63f9 100644 --- a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy +++ b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy @@ -462,4 +462,8 @@ final class GroovyParserTest extends GroovyTestCase { void "test groovy core - GROOVY-9507"() { doTest('bugs/BUG-GROOVY-9507.groovy'); } + +void "test groovy core - GROOVY-9522"() { +doTest('bugs/BUG-GROOVY-9522.groovy'); +} } diff --git a/subprojects/parser-antlr4/src/test/resources/bugs/BUG-GROOVY-9522.groovy b/subprojects/parser-antlr4/src/test/resources/bugs/BUG-GROOVY-9522.groovy new file mode 100644 index 000..021d62b --- /dev/null +++ b/subprojects/parser-antlr4/src/test/resources/bugs/BUG-GROOVY-9522.groovy @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + *http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under
[groovy] 04/04: GROOVY-9547: groovydoc: resolve tags later for Groovy source code (closes #1244)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_3_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git commit 040cc2bf59af467230444df01020c87a1b6a696a Author: Mikko Värri AuthorDate: Mon May 11 11:51:37 2020 +0300 GROOVY-9547: groovydoc: resolve tags later for Groovy source code (closes #1244) For Java source code, tags are resolved when the template asks for the comments. For Groovy, they were resolved as soon as the source file was processes. At that point, not all classes in the same package are processes, so links to those failed to link. --- .../tools/groovydoc/antlr4/GroovyDocParser.java| 6 +-- .../groovy/tools/groovydoc/GroovyDocToolTest.java | 44 ++ .../groovydoc/testfiles/GroovyInterface1.groovy| 10 - .../groovydoc/testfiles/JavaClassWithDiamond.java | 9 + 4 files changed, 63 insertions(+), 6 deletions(-) diff --git a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java index bbb66b3..ebb714c 100644 --- a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java +++ b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java @@ -86,11 +86,7 @@ public class GroovyDocParser implements GroovyDocParserI { ModuleNode root = unit.getAST(); GroovydocVisitor visitor = new GroovydocVisitor(unit, packagePath, links); visitor.visitClass(root.getClasses().get(0)); -Map groovyClassDocs = visitor.getGroovyClassDocs(); -for (GroovyClassDoc classDoc : groovyClassDocs.values()) { -replaceTags((SimpleGroovyClassDoc) classDoc); -} -return groovyClassDocs; +return visitor.getGroovyClassDocs(); } private void replaceTags(SimpleGroovyClassDoc sgcd) { diff --git a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java index 0292fb7..2c6f078 100644 --- a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java +++ b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java @@ -940,6 +940,50 @@ public class GroovyDocToolTest extends GroovyTestCase { )).matcher(javadoc).find()); } +public void testLinksToSamePackage() throws Exception { +final String base = "org/codehaus/groovy/tools/groovydoc/testfiles"; +htmlTool.add(Arrays.asList( +base + "/GroovyInterface1.groovy", +base + "/JavaClassWithDiamond.java" +)); + +final MockOutputTool output = new MockOutputTool(); +htmlTool.renderToOutput(output, MOCK_DIR); + +final String groovydoc = output.getText(MOCK_DIR + "/" + base + "/GroovyInterface1.html"); +final String javadoc = output.getText(MOCK_DIR + "/" + base + "/JavaClassWithDiamond.html"); + +final Matcher groovyClassComment = Pattern.compile(Pattern.quote( +" Java " + +"See Also:" + +"JavaClassWithDiamond" + +"" +)).matcher(groovydoc); +final Matcher groovyMethodComment = Pattern.compile(Pattern.quote( +" Java link " + +"See Also:" + +"JavaClassWithDiamond.link" + +"" +)).matcher(groovydoc); +final Matcher javaClassComment = Pattern.compile(Pattern.quote( +" Groovy link\n" + +" See Also:" + +"GroovyInterface1" + +"" +)).matcher(javadoc); +final Matcher javaMethodComment = Pattern.compile(Pattern.quote( +" Groovy link\n" + +" See Also:" + +"GroovyInterface1.link" + +"" +)).matcher(javadoc); + +assertTrue("The Groovy class comment should contain links", groovyClassComment.find()); +assertTrue("The Groovy method comment should contain links", groovyMethodComment.find()); +assertTrue("The Java class comment should contain links", javaClassComment.find()); +assertTrue("The Java method comment should contain links", javaMethodComment.find()); +} + public void testScript() throws Exception { List srcList = new ArrayList(); srcList.add("org/codehaus/groovy/tools/groovydoc/testfiles/Script.groovy"); diff --git
[groovy] 03/04: improved error message when parsing Java source file fails
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_3_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git commit e72c900bbf05c133bfe33ebf890bc2d2d56d3039 Author: Paul King AuthorDate: Mon May 11 20:48:41 2020 +1000 improved error message when parsing Java source file fails --- .../codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java index fb94a96..bbb66b3 100644 --- a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java +++ b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java @@ -65,7 +65,14 @@ public class GroovyDocParser implements GroovyDocParserI { private Map parseJava(String packagePath, String file, String src) throws RuntimeException { GroovydocJavaVisitor visitor = new GroovydocJavaVisitor(packagePath, links); -visitor.visit(StaticJavaParser.parse(src), null); +try { +visitor.visit(StaticJavaParser.parse(src), null); +} catch(Throwable t) { +System.err.println("Attempting to ignore error parsing Java source file: " + packagePath + "/" + file); +System.err.println("Consider reporting the error to the Groovy project: https://issues.apache.org/jira/browse/GROOVY;); +System.err.println("... or directly to the JavaParser project: https://github.com/javaparser/javaparser/issues;); +System.err.println("Error: " + t.getMessage()); +} return visitor.getGroovyClassDocs(); }
[groovy] 01/04: GROOVY-9546: groovydoc: fix annotation rendering (closes #1243)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_3_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git commit feb09671193177280ad592fa199f53252c175a94 Author: Mikko Värri AuthorDate: Mon May 11 05:42:16 2020 +0300 GROOVY-9546: groovydoc: fix annotation rendering (closes #1243) --- .../org/apache/groovy/antlr/GroovydocVisitor.java | 4 +- .../tools/groovydoc/SimpleGroovyAnnotationRef.java | 4 +- .../groovydoc/antlr4/GroovydocJavaVisitor.java | 11 +++- .../gstringTemplates/classLevel/classDocName.html | 2 +- .../groovy/tools/groovydoc/GroovyDocToolTest.java | 69 ++ .../tools/groovydoc/testfiles/anno/Groovy.groovy | 39 .../tools/groovydoc/testfiles/anno/Java.java | 40 + 7 files changed, 163 insertions(+), 6 deletions(-) diff --git a/subprojects/groovy-groovydoc/src/main/java/org/apache/groovy/antlr/GroovydocVisitor.java b/subprojects/groovy-groovydoc/src/main/java/org/apache/groovy/antlr/GroovydocVisitor.java index 4275e03..a89b7e7 100644 --- a/subprojects/groovy-groovydoc/src/main/java/org/apache/groovy/antlr/GroovydocVisitor.java +++ b/subprojects/groovy-groovydoc/src/main/java/org/apache/groovy/antlr/GroovydocVisitor.java @@ -185,14 +185,14 @@ public class GroovydocVisitor extends ClassCodeVisitorSupport { private void processAnnotations(SimpleGroovyProgramElementDoc element, AnnotatedNode node) { for (AnnotationNode an : node.getAnnotations()) { String name = an.getClassNode().getName(); -element.addAnnotationRef(new SimpleGroovyAnnotationRef(name, name)); +element.addAnnotationRef(new SimpleGroovyAnnotationRef(name, an.getText())); } } private void processAnnotations(SimpleGroovyParameter param, AnnotatedNode node) { for (AnnotationNode an : node.getAnnotations()) { String name = an.getClassNode().getName(); -param.addAnnotationRef(new SimpleGroovyAnnotationRef(name, name)); +param.addAnnotationRef(new SimpleGroovyAnnotationRef(name, an.getText())); } } diff --git a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyAnnotationRef.java b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyAnnotationRef.java index 07bdda0..9540bda 100644 --- a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyAnnotationRef.java +++ b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyAnnotationRef.java @@ -20,6 +20,7 @@ package org.codehaus.groovy.tools.groovydoc; import org.codehaus.groovy.groovydoc.GroovyAnnotationRef; import org.codehaus.groovy.groovydoc.GroovyClassDoc; +import org.codehaus.groovy.runtime.StringGroovyMethods; public class SimpleGroovyAnnotationRef implements GroovyAnnotationRef { private GroovyClassDoc type; @@ -27,8 +28,9 @@ public class SimpleGroovyAnnotationRef implements GroovyAnnotationRef { private String name; public SimpleGroovyAnnotationRef(String name, String desc) { -this.desc = desc; this.name = name; +final String params = StringGroovyMethods.minus(desc, "@" + name); +this.desc = "()".equals(params) ? "" : params; } public void setType(GroovyClassDoc type) { diff --git a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovydocJavaVisitor.java b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovydocJavaVisitor.java index 834c068..1848631 100644 --- a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovydocJavaVisitor.java +++ b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovydocJavaVisitor.java @@ -218,16 +218,23 @@ public class GroovydocJavaVisitor extends VoidVisitorAdapter { private void processAnnotations(SimpleGroovyProgramElementDoc element, NodeWithAnnotations n) { for (AnnotationExpr an : n.getAnnotations()) { -element.addAnnotationRef(new SimpleGroovyAnnotationRef(an.getClass().getName(), an.getNameAsString())); +element.addAnnotationRef(new SimpleGroovyAnnotationRef(an.getNameAsString(), getAnnotationText(an))); } } private void processAnnotations(SimpleGroovyParameter param, NodeWithAnnotations n) { for (AnnotationExpr an : n.getAnnotations()) { -param.addAnnotationRef(new SimpleGroovyAnnotationRef(an.getClass().getName(), an.getNameAsString())); +param.addAnnotationRef(new SimpleGroovyAnnotationRef(an.getNameAsString(), getAnnotationText(an))); } } +private String getAnnotationText(final AnnotationExpr an) { +if (an != null && an.getTokenRange().isPresent()) { +
[groovy] branch GROOVY_3_0_X updated (7cdcbf2 -> 040cc2b)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a change to branch GROOVY_3_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git. from 7cdcbf2 GROOVY-9544: Bump gradle to 6.4 new feb0967 GROOVY-9546: groovydoc: fix annotation rendering (closes #1243) new aeb4cec GROOVY-9465: groovydoc: show class declaration header for all types (closes #1242) new e72c900 improved error message when parsing Java source file fails new 040cc2b GROOVY-9547: groovydoc: resolve tags later for Groovy source code (closes #1244) The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../org/apache/groovy/antlr/GroovydocVisitor.java | 4 +- .../tools/groovydoc/SimpleGroovyAnnotationRef.java | 4 +- .../tools/groovydoc/antlr4/GroovyDocParser.java| 15 ++- .../groovydoc/antlr4/GroovydocJavaVisitor.java | 11 +- .../gstringTemplates/classLevel/classDocName.html | 6 +- .../groovy/tools/groovydoc/GroovyDocToolTest.java | 134 + .../groovydoc/testfiles/GroovyInterface1.groovy| 10 +- .../groovydoc/testfiles/JavaClassWithDiamond.java | 9 ++ .../tools/groovydoc/testfiles/anno/Groovy.groovy} | 21 +++- .../tools/groovydoc/testfiles/anno/Java.java | 33 ++--- 10 files changed, 210 insertions(+), 37 deletions(-) copy subprojects/{performance/src/jmh/groovy/org/apache/groovy/bench/GeneratedHashCode.groovy => groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/anno/Groovy.groovy} (59%) copy src/test/groovy/bugs/Groovy3784Bug.groovy => subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/anno/Java.java (61%)
[groovy] 02/04: GROOVY-9465: groovydoc: show class declaration header for all types (closes #1242)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_3_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git commit aeb4cecca7a7e01d09c6d4bb0d1a742725687f30 Author: Mikko Värri AuthorDate: Mon May 11 02:03:31 2020 +0300 GROOVY-9465: groovydoc: show class declaration header for all types (closes #1242) --- .../gstringTemplates/classLevel/classDocName.html | 4 ++-- .../groovy/tools/groovydoc/GroovyDocToolTest.java | 21 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/subprojects/groovy-groovydoc/src/main/resources/org/codehaus/groovy/tools/groovydoc/gstringTemplates/classLevel/classDocName.html b/subprojects/groovy-groovydoc/src/main/resources/org/codehaus/groovy/tools/groovydoc/gstringTemplates/classLevel/classDocName.html index 0091217..e3dfe10 100644 --- a/subprojects/groovy-groovydoc/src/main/resources/org/codehaus/groovy/tools/groovydoc/gstringTemplates/classLevel/classDocName.html +++ b/subprojects/groovy-groovydoc/src/main/resources/org/codehaus/groovy/tools/groovydoc/gstringTemplates/classLevel/classDocName.html @@ -225,6 +225,8 @@ if (classDoc.isInterface()) { All Implemented Interfaces and Traits: ${interfaces.collect{ linkable(it) }.join(', ')} +<% } %> +<% } %> @@ -235,8 +237,6 @@ if (classDoc.isInterface()) { %>extends ${linkable(classDoc.superclass())} <% } %> -<% } %> -<% } %> <% if (classDoc.commentText()) { %> ${classDoc.commentText()} <% } %> diff --git a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java index 581c795..0292fb7 100644 --- a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java +++ b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java @@ -720,6 +720,27 @@ public class GroovyDocToolTest extends GroovyTestCase { assertEquals("The constructor parameter link text should be Foo", "Foo", constructor.group(3)); } +public void testClassDeclarationHeader() throws Exception { +final String base = "org/codehaus/groovy/tools/groovydoc/testfiles/a"; +htmlTool.add(Arrays.asList( +base + "/Base.groovy" +)); + +final MockOutputTool output = new MockOutputTool(); +htmlTool.renderToOutput(output, MOCK_DIR); + +final String basedoc = output.getText(MOCK_DIR + "/" + base + "/Base.html"); + +final Matcher classDecl = Pattern.compile(Pattern.quote( +"class Base\n"+ +"extends Object\n"+ +"\n"+ +"" +)).matcher(basedoc); + +assertTrue("The class declaration header should exist in class description", classDecl.find()); +} + public void testJavaGenericsTitle() throws Exception { final String base = "org/codehaus/groovy/tools/groovydoc/testfiles/generics"; htmlTool.add(Arrays.asList(
[groovy] branch GROOVY-9522 updated (534f993 -> ed04da9)
This is an automated email from the ASF dual-hosted git repository. sunlan pushed a change to branch GROOVY-9522 in repository https://gitbox.apache.org/repos/asf/groovy.git. discard 534f993 GROOVY-9522: Throwing NPE when I use ternary operator with something special new ed04da9 GROOVY-9522: Throwing NPE when I use ternary operator with something special This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (534f993) \ N -- N -- N refs/heads/GROOVY-9522 (ed04da9) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: src/antlr/GroovyParser.g4 | 12 ++-- .../org/apache/groovy/parser/antlr4/AstBuilder.java| 18 +- .../src/test/resources/bugs/BUG-GROOVY-9522.groovy | 5 + 3 files changed, 24 insertions(+), 11 deletions(-)
[groovy] 01/01: GROOVY-9522: Throwing NPE when I use ternary operator with something special
This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch GROOVY-9522 in repository https://gitbox.apache.org/repos/asf/groovy.git commit ed04da9a178d92d0e27bc39129141398f942edee Author: Daniel Sun AuthorDate: Tue May 12 08:25:16 2020 +0800 GROOVY-9522: Throwing NPE when I use ternary operator with something special --- src/antlr/GroovyParser.g4 | 46 -- .../apache/groovy/parser/antlr4/AstBuilder.java| 18 - .../groovy/parser/antlr4/GroovyParserTest.groovy | 4 ++ .../src/test/resources/bugs/BUG-GROOVY-9522.groovy | 37 + 4 files changed, 93 insertions(+), 12 deletions(-) diff --git a/src/antlr/GroovyParser.g4 b/src/antlr/GroovyParser.g4 index 29f347c..47b212c 100644 --- a/src/antlr/GroovyParser.g4 +++ b/src/antlr/GroovyParser.g4 @@ -1008,6 +1008,13 @@ options { baseContext = primary; } | parExpression #parenPrmrAlt ; +namedArgPrimary +options { baseContext = primary; } +: identifier #identifierPrmrAlt +| literal #literalPrmrAlt +| gstring #gstringPrmrAlt +; + commandPrimary options { baseContext = primary; } : identifier #identifierPrmrAlt @@ -1047,6 +1054,12 @@ options { baseContext = mapEntry; } | MUL COLON nls expression ; +namedArg +options { baseContext = mapEntry; } +: namedArgLabel COLON nls expression +| MUL COLON nls expression +; + mapEntryLabel : keywords | primary @@ -1058,6 +1071,12 @@ options { baseContext = mapEntryLabel; } | namedPropertyArgPrimary ; +namedArgLabel +options { baseContext = mapEntryLabel; } +: keywords +| namedArgPrimary +; + /** * t 0: general creation; 1: non-static inner class creation */ @@ -1100,30 +1119,51 @@ typeArgumentsOrDiamond ; arguments -: LPAREN enhancedArgumentList? COMMA? rparen +: LPAREN enhancedArgumentListInPar? COMMA? rparen ; argumentList -options { baseContext = enhancedArgumentList; } -: argumentListElement +options { baseContext = enhancedArgumentListInPar; } +: firstArgumentListElement ( COMMA nls argumentListElement )* ; enhancedArgumentList +options { baseContext = enhancedArgumentListInPar; } +: firstEnhancedArgumentListElement +( COMMA nls +enhancedArgumentListElement +)* +; + +enhancedArgumentListInPar : enhancedArgumentListElement ( COMMA nls enhancedArgumentListElement )* ; +firstArgumentListElement +options { baseContext = enhancedArgumentListElement; } +: expressionListElement[true] +| namedArg +; + argumentListElement options { baseContext = enhancedArgumentListElement; } : expressionListElement[true] | namedPropertyArg ; +firstEnhancedArgumentListElement +options { baseContext = enhancedArgumentListElement; } +: expressionListElement[true] +| standardLambdaExpression +| namedArg +; + enhancedArgumentListElement : expressionListElement[true] | standardLambdaExpression diff --git a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java index b366212..d5f80d1 100644 --- a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java +++ b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java @@ -201,8 +201,8 @@ import static org.apache.groovy.parser.antlr4.GroovyLangParser.ElementValuePairs import static org.apache.groovy.parser.antlr4.GroovyLangParser.ElementValuesContext; import static org.apache.groovy.parser.antlr4.GroovyLangParser.EmptyDimsContext; import static org.apache.groovy.parser.antlr4.GroovyLangParser.EmptyDimsOptContext; -import static org.apache.groovy.parser.antlr4.GroovyLangParser.EnhancedArgumentListContext; import static org.apache.groovy.parser.antlr4.GroovyLangParser.EnhancedArgumentListElementContext; +import static org.apache.groovy.parser.antlr4.GroovyLangParser.EnhancedArgumentListInParContext; import static org.apache.groovy.parser.antlr4.GroovyLangParser.EnhancedForControlContext; import static org.apache.groovy.parser.antlr4.GroovyLangParser.EnhancedStatementExpressionContext; import static org.apache.groovy.parser.antlr4.GroovyLangParser.EnumConstantContext; @@ -2018,7 +2018,7 @@ public class AstBuilder extends GroovyParserBaseVisitor { @Override
[groovy] branch GROOVY-9522 created (now 534f993)
This is an automated email from the ASF dual-hosted git repository. sunlan pushed a change to branch GROOVY-9522 in repository https://gitbox.apache.org/repos/asf/groovy.git. at 534f993 GROOVY-9522: Throwing NPE when I use ternary operator with something special This branch includes the following new commits: new 534f993 GROOVY-9522: Throwing NPE when I use ternary operator with something special The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[groovy] branch GROOVY_3_0_X updated: GROOVY-9540: Bump spotbugs plugin to 4.0.8
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_3_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push: new 5dcc0d2 GROOVY-9540: Bump spotbugs plugin to 4.0.8 5dcc0d2 is described below commit 5dcc0d2d9d04e82649720c310349a97b524f32a8 Author: Paul King AuthorDate: Tue May 5 09:48:37 2020 +1000 GROOVY-9540: Bump spotbugs plugin to 4.0.8 --- build.gradle | 2 +- gradle/quality.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 15983c6..f387e6c 100644 --- a/build.gradle +++ b/build.gradle @@ -46,7 +46,7 @@ buildscript { plugins { id 'me.champeau.buildscan-recipes' version '0.2.3' -id 'com.github.spotbugs' version '4.0.5' +id 'com.github.spotbugs' version '4.0.8' id 'com.github.ben-manes.versions' version '0.28.0' id 'com.github.blindpirate.osgi' version '0.0.3' id 'org.sonarqube' version '2.8' diff --git a/gradle/quality.gradle b/gradle/quality.gradle index d13952b..eebe168 100644 --- a/gradle/quality.gradle +++ b/gradle/quality.gradle @@ -152,7 +152,7 @@ allprojects { proj -> xml.enabled = false html { enabled = true -stylesheet = 'plain.xsl' +stylesheet = 'fancy.xsl' } } }
[groovy] branch master updated: GROOVY-9551: Bump JavaParser to 3.15.22
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/master by this push: new 993f19a GROOVY-9551: Bump JavaParser to 3.15.22 993f19a is described below commit 993f19aa1f565ba01036563d64b0bd0a3408f19e Author: Paul King AuthorDate: Tue May 12 11:27:29 2020 +1000 GROOVY-9551: Bump JavaParser to 3.15.22 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index b5b3839..ffb1753 100644 --- a/build.gradle +++ b/build.gradle @@ -134,7 +134,7 @@ ext { ivyVersion = '2.5.0' jansiVersion = '1.18' jarjarVersion = '1.7.2' -javaParserVersion = '3.15.21' +javaParserVersion = '3.15.22' jlineVersion = '2.14.6' jmockVersion = '1.2.0' logbackVersion = '1.1.7'
[groovy] branch GROOVY_3_0_X updated: GROOVY-9551: Bump JavaParser to 3.15.22
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_3_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push: new 45d915c GROOVY-9551: Bump JavaParser to 3.15.22 45d915c is described below commit 45d915c63df27f33cd080d361375d80d15bb8ec9 Author: Paul King AuthorDate: Tue May 12 11:27:29 2020 +1000 GROOVY-9551: Bump JavaParser to 3.15.22 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 695cc72..15983c6 100644 --- a/build.gradle +++ b/build.gradle @@ -138,7 +138,7 @@ ext { ivyVersion = '2.5.0' jansiVersion = '1.18' jarjarVersion = '1.7.2' -javaParserVersion = '3.15.21' +javaParserVersion = '3.15.22' jlineVersion = '2.14.6' jmockVersion = '1.2.0' logbackVersion = '1.1.7'
[groovy] 03/03: improved error message when parsing Java source file fails
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git commit 657afee6848a3c5c832439a1bc063cb368104886 Author: Paul King AuthorDate: Mon May 11 20:48:41 2020 +1000 improved error message when parsing Java source file fails --- .../codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java index fb94a96..bbb66b3 100644 --- a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java +++ b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java @@ -65,7 +65,14 @@ public class GroovyDocParser implements GroovyDocParserI { private Map parseJava(String packagePath, String file, String src) throws RuntimeException { GroovydocJavaVisitor visitor = new GroovydocJavaVisitor(packagePath, links); -visitor.visit(StaticJavaParser.parse(src), null); +try { +visitor.visit(StaticJavaParser.parse(src), null); +} catch(Throwable t) { +System.err.println("Attempting to ignore error parsing Java source file: " + packagePath + "/" + file); +System.err.println("Consider reporting the error to the Groovy project: https://issues.apache.org/jira/browse/GROOVY;); +System.err.println("... or directly to the JavaParser project: https://github.com/javaparser/javaparser/issues;); +System.err.println("Error: " + t.getMessage()); +} return visitor.getGroovyClassDocs(); }
[groovy] 01/03: GROOVY-9546: groovydoc: fix annotation rendering (closes #1243)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git commit 302bf2bf27b28fe6ffc86171b408698490229c17 Author: Mikko Värri AuthorDate: Mon May 11 05:42:16 2020 +0300 GROOVY-9546: groovydoc: fix annotation rendering (closes #1243) --- .../org/apache/groovy/antlr/GroovydocVisitor.java | 4 +- .../tools/groovydoc/SimpleGroovyAnnotationRef.java | 4 +- .../groovydoc/antlr4/GroovydocJavaVisitor.java | 11 +++- .../gstringTemplates/classLevel/classDocName.html | 2 +- .../groovy/tools/groovydoc/GroovyDocToolTest.java | 69 ++ .../tools/groovydoc/testfiles/anno/Groovy.groovy | 39 .../tools/groovydoc/testfiles/anno/Java.java | 40 + 7 files changed, 163 insertions(+), 6 deletions(-) diff --git a/subprojects/groovy-groovydoc/src/main/java/org/apache/groovy/antlr/GroovydocVisitor.java b/subprojects/groovy-groovydoc/src/main/java/org/apache/groovy/antlr/GroovydocVisitor.java index 4275e03..a89b7e7 100644 --- a/subprojects/groovy-groovydoc/src/main/java/org/apache/groovy/antlr/GroovydocVisitor.java +++ b/subprojects/groovy-groovydoc/src/main/java/org/apache/groovy/antlr/GroovydocVisitor.java @@ -185,14 +185,14 @@ public class GroovydocVisitor extends ClassCodeVisitorSupport { private void processAnnotations(SimpleGroovyProgramElementDoc element, AnnotatedNode node) { for (AnnotationNode an : node.getAnnotations()) { String name = an.getClassNode().getName(); -element.addAnnotationRef(new SimpleGroovyAnnotationRef(name, name)); +element.addAnnotationRef(new SimpleGroovyAnnotationRef(name, an.getText())); } } private void processAnnotations(SimpleGroovyParameter param, AnnotatedNode node) { for (AnnotationNode an : node.getAnnotations()) { String name = an.getClassNode().getName(); -param.addAnnotationRef(new SimpleGroovyAnnotationRef(name, name)); +param.addAnnotationRef(new SimpleGroovyAnnotationRef(name, an.getText())); } } diff --git a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyAnnotationRef.java b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyAnnotationRef.java index 07bdda0..9540bda 100644 --- a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyAnnotationRef.java +++ b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyAnnotationRef.java @@ -20,6 +20,7 @@ package org.codehaus.groovy.tools.groovydoc; import org.codehaus.groovy.groovydoc.GroovyAnnotationRef; import org.codehaus.groovy.groovydoc.GroovyClassDoc; +import org.codehaus.groovy.runtime.StringGroovyMethods; public class SimpleGroovyAnnotationRef implements GroovyAnnotationRef { private GroovyClassDoc type; @@ -27,8 +28,9 @@ public class SimpleGroovyAnnotationRef implements GroovyAnnotationRef { private String name; public SimpleGroovyAnnotationRef(String name, String desc) { -this.desc = desc; this.name = name; +final String params = StringGroovyMethods.minus(desc, "@" + name); +this.desc = "()".equals(params) ? "" : params; } public void setType(GroovyClassDoc type) { diff --git a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovydocJavaVisitor.java b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovydocJavaVisitor.java index 834c068..1848631 100644 --- a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovydocJavaVisitor.java +++ b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovydocJavaVisitor.java @@ -218,16 +218,23 @@ public class GroovydocJavaVisitor extends VoidVisitorAdapter { private void processAnnotations(SimpleGroovyProgramElementDoc element, NodeWithAnnotations n) { for (AnnotationExpr an : n.getAnnotations()) { -element.addAnnotationRef(new SimpleGroovyAnnotationRef(an.getClass().getName(), an.getNameAsString())); +element.addAnnotationRef(new SimpleGroovyAnnotationRef(an.getNameAsString(), getAnnotationText(an))); } } private void processAnnotations(SimpleGroovyParameter param, NodeWithAnnotations n) { for (AnnotationExpr an : n.getAnnotations()) { -param.addAnnotationRef(new SimpleGroovyAnnotationRef(an.getClass().getName(), an.getNameAsString())); +param.addAnnotationRef(new SimpleGroovyAnnotationRef(an.getNameAsString(), getAnnotationText(an))); } } +private String getAnnotationText(final AnnotationExpr an) { +if (an != null && an.getTokenRange().isPresent()) { +
[groovy] branch master updated (26efb1e -> 657afee)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git. from 26efb1e add a reworked testcase for suspicious test (currently commented out) new 302bf2b GROOVY-9546: groovydoc: fix annotation rendering (closes #1243) new 27bcbb1 GROOVY-9465: groovydoc: show class declaration header for all types (closes #1242) new 657afee improved error message when parsing Java source file fails The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../org/apache/groovy/antlr/GroovydocVisitor.java | 4 +- .../tools/groovydoc/SimpleGroovyAnnotationRef.java | 4 +- .../tools/groovydoc/antlr4/GroovyDocParser.java| 9 ++- .../groovydoc/antlr4/GroovydocJavaVisitor.java | 11 ++- .../gstringTemplates/classLevel/classDocName.html | 6 +- .../groovy/tools/groovydoc/GroovyDocToolTest.java | 90 ++ .../tools/groovydoc/testfiles/anno/Groovy.groovy} | 21 +++-- .../tools/groovydoc/testfiles/anno/Java.java | 33 8 files changed, 147 insertions(+), 31 deletions(-) copy subprojects/{performance/src/jmh/groovy/org/apache/groovy/bench/GeneratedHashCode.groovy => groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/anno/Groovy.groovy} (59%) copy src/test/groovy/bugs/Groovy3784Bug.groovy => subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/anno/Java.java (61%)
[groovy] 02/03: GROOVY-9465: groovydoc: show class declaration header for all types (closes #1242)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git commit 27bcbb18ba99ba3cdb8e488836a7e8f2042ff1b2 Author: Mikko Värri AuthorDate: Mon May 11 02:03:31 2020 +0300 GROOVY-9465: groovydoc: show class declaration header for all types (closes #1242) --- .../gstringTemplates/classLevel/classDocName.html | 4 ++-- .../groovy/tools/groovydoc/GroovyDocToolTest.java | 21 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/subprojects/groovy-groovydoc/src/main/resources/org/codehaus/groovy/tools/groovydoc/gstringTemplates/classLevel/classDocName.html b/subprojects/groovy-groovydoc/src/main/resources/org/codehaus/groovy/tools/groovydoc/gstringTemplates/classLevel/classDocName.html index 0091217..e3dfe10 100644 --- a/subprojects/groovy-groovydoc/src/main/resources/org/codehaus/groovy/tools/groovydoc/gstringTemplates/classLevel/classDocName.html +++ b/subprojects/groovy-groovydoc/src/main/resources/org/codehaus/groovy/tools/groovydoc/gstringTemplates/classLevel/classDocName.html @@ -225,6 +225,8 @@ if (classDoc.isInterface()) { All Implemented Interfaces and Traits: ${interfaces.collect{ linkable(it) }.join(', ')} +<% } %> +<% } %> @@ -235,8 +237,6 @@ if (classDoc.isInterface()) { %>extends ${linkable(classDoc.superclass())} <% } %> -<% } %> -<% } %> <% if (classDoc.commentText()) { %> ${classDoc.commentText()} <% } %> diff --git a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java index 581c795..0292fb7 100644 --- a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java +++ b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java @@ -720,6 +720,27 @@ public class GroovyDocToolTest extends GroovyTestCase { assertEquals("The constructor parameter link text should be Foo", "Foo", constructor.group(3)); } +public void testClassDeclarationHeader() throws Exception { +final String base = "org/codehaus/groovy/tools/groovydoc/testfiles/a"; +htmlTool.add(Arrays.asList( +base + "/Base.groovy" +)); + +final MockOutputTool output = new MockOutputTool(); +htmlTool.renderToOutput(output, MOCK_DIR); + +final String basedoc = output.getText(MOCK_DIR + "/" + base + "/Base.html"); + +final Matcher classDecl = Pattern.compile(Pattern.quote( +"class Base\n"+ +"extends Object\n"+ +"\n"+ +"" +)).matcher(basedoc); + +assertTrue("The class declaration header should exist in class description", classDecl.find()); +} + public void testJavaGenericsTitle() throws Exception { final String base = "org/codehaus/groovy/tools/groovydoc/testfiles/generics"; htmlTool.add(Arrays.asList(
[groovy] branch master updated: GROOVY-9547: groovydoc: resolve tags later for Groovy source code (closes #1244)
This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git The following commit(s) were added to refs/heads/master by this push: new 9095a3a GROOVY-9547: groovydoc: resolve tags later for Groovy source code (closes #1244) 9095a3a is described below commit 9095a3a14335216dc55c660465a133da816c50b3 Author: Mikko Värri AuthorDate: Mon May 11 11:51:37 2020 +0300 GROOVY-9547: groovydoc: resolve tags later for Groovy source code (closes #1244) For Java source code, tags are resolved when the template asks for the comments. For Groovy, they were resolved as soon as the source file was processes. At that point, not all classes in the same package are processes, so links to those failed to link. --- .../tools/groovydoc/antlr4/GroovyDocParser.java| 6 +-- .../groovy/tools/groovydoc/GroovyDocToolTest.java | 44 ++ .../groovydoc/testfiles/GroovyInterface1.groovy| 10 - .../groovydoc/testfiles/JavaClassWithDiamond.java | 9 + 4 files changed, 63 insertions(+), 6 deletions(-) diff --git a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java index bbb66b3..ebb714c 100644 --- a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java +++ b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/antlr4/GroovyDocParser.java @@ -86,11 +86,7 @@ public class GroovyDocParser implements GroovyDocParserI { ModuleNode root = unit.getAST(); GroovydocVisitor visitor = new GroovydocVisitor(unit, packagePath, links); visitor.visitClass(root.getClasses().get(0)); -Map groovyClassDocs = visitor.getGroovyClassDocs(); -for (GroovyClassDoc classDoc : groovyClassDocs.values()) { -replaceTags((SimpleGroovyClassDoc) classDoc); -} -return groovyClassDocs; +return visitor.getGroovyClassDocs(); } private void replaceTags(SimpleGroovyClassDoc sgcd) { diff --git a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java index 0292fb7..2c6f078 100644 --- a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java +++ b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java @@ -940,6 +940,50 @@ public class GroovyDocToolTest extends GroovyTestCase { )).matcher(javadoc).find()); } +public void testLinksToSamePackage() throws Exception { +final String base = "org/codehaus/groovy/tools/groovydoc/testfiles"; +htmlTool.add(Arrays.asList( +base + "/GroovyInterface1.groovy", +base + "/JavaClassWithDiamond.java" +)); + +final MockOutputTool output = new MockOutputTool(); +htmlTool.renderToOutput(output, MOCK_DIR); + +final String groovydoc = output.getText(MOCK_DIR + "/" + base + "/GroovyInterface1.html"); +final String javadoc = output.getText(MOCK_DIR + "/" + base + "/JavaClassWithDiamond.html"); + +final Matcher groovyClassComment = Pattern.compile(Pattern.quote( +" Java " + +"See Also:" + +"JavaClassWithDiamond" + +"" +)).matcher(groovydoc); +final Matcher groovyMethodComment = Pattern.compile(Pattern.quote( +" Java link " + +"See Also:" + +"JavaClassWithDiamond.link" + +"" +)).matcher(groovydoc); +final Matcher javaClassComment = Pattern.compile(Pattern.quote( +" Groovy link\n" + +" See Also:" + +"GroovyInterface1" + +"" +)).matcher(javadoc); +final Matcher javaMethodComment = Pattern.compile(Pattern.quote( +" Groovy link\n" + +" See Also:" + +"GroovyInterface1.link" + +"" +)).matcher(javadoc); + +assertTrue("The Groovy class comment should contain links", groovyClassComment.find()); +assertTrue("The Groovy method comment should contain links", groovyMethodComment.find()); +assertTrue("The Java class comment should contain links", javaClassComment.find()); +assertTrue("The Java method comment should contain links", javaMethodComment.find()); +} + public void testScript() throws Exception { List srcList = new