groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [groovy] 02/02: GROOVY-8296: Groovydoc Recognition exception with Java 8 class (improve name resolving)
Date Sun, 12 Jan 2020 08:26:30 GMT
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 35649760d0130c78e537aa766a2bbaa4274493da
Author: Paul King <paulk@asert.com.au>
AuthorDate: Sun Jan 12 18:25:06 2020 +1000

    GROOVY-8296: Groovydoc Recognition exception with Java 8 class (improve name resolving)
---
 .../codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java | 11 +++++++++++
 1 file changed, 11 insertions(+)

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 ff1221c..140e4d2 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
@@ -588,6 +588,8 @@ public class SimpleGroovyClassDoc extends SimpleGroovyAbstractableElementDoc
imp
             if (slashIndex < 1) {
                 doc = resolveInternalClassDocFromImport(rootDoc, name);
                 if (doc != null) return doc;
+                doc = resolveInternalClassDocFromSamePackage(rootDoc, name);
+                if (doc != null) return doc;
                 for (GroovyClassDoc nestedDoc : nested) {
                     if (nestedDoc.name().endsWith("." + name))
                         return nestedDoc;
@@ -680,6 +682,15 @@ public class SimpleGroovyClassDoc extends SimpleGroovyAbstractableElementDoc
imp
         return null;
     }
 
+    private GroovyClassDoc resolveInternalClassDocFromSamePackage(GroovyRootDoc rootDoc,
String baseName) {
+        if (isPrimitiveType(baseName)) return null;
+        if (baseName.contains(".")) return null;
+        int lastSlash = fullPathName.lastIndexOf("/");
+        if (lastSlash < 0) return null;
+        String pkg = fullPathName.substring(0, lastSlash + 1);
+        return ((SimpleGroovyRootDoc)rootDoc).classNamedExact(pkg + baseName);
+    }
+
     private Class resolveExternalClassFromImport(String name) {
         if (isPrimitiveType(name)) return null;
         Class<?> clazz = resolvedExternalClassesCache.get(name);


Mime
View raw message