groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [groovy] 03/05: GROOVY-8296: Groovydoc Recognition exception with Java 8 class (trivial refactor)
Date Sat, 11 Jan 2020 02:05:07 GMT
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 1b2b84cafa1249148b375aae8ec4f1fba142ddca
Author: Paul King <paulk@asert.com.au>
AuthorDate: Sat Jan 11 11:55:30 2020 +1000

    GROOVY-8296: Groovydoc Recognition exception with Java 8 class (trivial refactor)
---
 .../org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java   | 6 +++---
 .../groovy/tools/groovydoc/antlr4/GroovydocJavaVisitor.java         | 6 +++---
 .../src/main/groovy/groovy/text/GStringTemplateEngine.java          | 1 -
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java
b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java
index 5b61c6c..9efc1df 100644
--- a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java
+++ b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java
@@ -517,11 +517,11 @@ public class SimpleGroovyClassDoc extends SimpleGroovyAbstractableElementDoc
imp
         final String[] target = type.split("#");
         String shortClassName = target[0].replaceAll(".*\\.", "");
         shortClassName += (target.length > 1 ? "#" + target[1].split("\\(")[0] : "");
-        String name = (full ? target[0] : shortClassName).replaceAll("#", ".").replace('$',
'.');
+        String name = (full ? target[0] : shortClassName).replace('#', '.').replace('$',
'.');
 
         // last chance lookup for classes within the current codebase
         if (rootDoc != null) {
-            String slashedName = target[0].replaceAll("\\.", "/");
+            String slashedName = target[0].replace('.', '/');
             GroovyClassDoc doc = rootDoc.classNamed(classDoc, slashedName);
             if (doc != null) {
                 target[0] = doc.getFullPathName(); // if we added a package
@@ -696,7 +696,7 @@ public class SimpleGroovyClassDoc extends SimpleGroovyAbstractableElementDoc
imp
         for (String importName : importedClassesAndPackages) {
             String candidate = null;
             if (importName.endsWith("/" + name)) {
-                candidate = importName.replaceAll("/", ".");
+                candidate = importName.replace('/', '.');
             } else if (importName.endsWith("/*")) {
                 candidate = importName.substring(0, importName.length() - 2).replace('/',
'.') + "." + name;
             }
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 d3145dc..882a1f6 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
@@ -78,7 +78,7 @@ public class GroovydocJavaVisitor extends VoidVisitorAdapter<Object>
{
     @Override
     public void visit(ImportDeclaration n, Object arg) {
         Optional<Name> qualPath = n.getName().getQualifier();
-        String qual = qualPath.map(value -> value.asString().replaceAll("\\.", "/") +
"/").orElse("");
+        String qual = qualPath.map(value -> value.asString().replace('.', '/') + "/").orElse("");
         String id = n.getName().getIdentifier();
         String name = qual + id;
         imports.add(name);
@@ -188,7 +188,7 @@ public class GroovydocJavaVisitor extends VoidVisitorAdapter<Object>
{
             parent = currentClassDoc;
             name = parent.name() + "$" + name;
         }
-        currentClassDoc = new SimpleGroovyClassDoc(imports, aliases, name.replaceAll("\\$",
"."), links);
+        currentClassDoc = new SimpleGroovyClassDoc(imports, aliases, name.replace('$', '.'),
links);
         if (parent != null) {
             parent.addNested(currentClassDoc);
         }
@@ -237,7 +237,7 @@ public class GroovydocJavaVisitor extends VoidVisitorAdapter<Object>
{
     }
 
     private String withSlashes(String s) {
-        return s.replaceAll("\\.", "/").replaceAll("\\$", ".");
+        return s.replace('.', '/').replace('$', '.');
     }
 
     @Override
diff --git a/subprojects/groovy-templates/src/main/groovy/groovy/text/GStringTemplateEngine.java
b/subprojects/groovy-templates/src/main/groovy/groovy/text/GStringTemplateEngine.java
index 9190840..27c53de 100644
--- a/subprojects/groovy-templates/src/main/groovy/groovy/text/GStringTemplateEngine.java
+++ b/subprojects/groovy-templates/src/main/groovy/groovy/text/GStringTemplateEngine.java
@@ -199,7 +199,6 @@ public class GStringTemplateEngine extends TemplateEngine {
             try {
                 groovyClass = loader.parseClass(new GroovyCodeSource(templateExpressions.toString(),
"GStringTemplateScript" + counter.incrementAndGet() + ".groovy", "x"));
             } catch (Exception e) {
-                System.err.println("templateExpressions = " + templateExpressions);
                 throw new GroovyRuntimeException("Failed to parse template script (your template
may contain an error or be trying to use expressions not currently supported): " + e.getMessage());
             }
 


Mime
View raw message