Skip to content
Permalink
Browse files
bugfix: (groovy-doc) add star imports in the list of imports used by …
…SimpleGroovyClassDoc
  • Loading branch information
stalb authored and paulk-asert committed May 3, 2022
1 parent ee1847e commit 7926dd8b1e32b7a72172902221ef5e1a45334509
Showing 3 changed files with 6 additions and 1 deletion.
@@ -97,6 +97,10 @@ public void visitClass(ClassNode node) {
aliases.put(iNode.getAlias(), name.replace('.', '/'));
}
}
for (ImportNode iNode : node.getModule().getStarImports()) {
String name = iNode.getPackageName()+"*";
imports.add(name.replace('.', '/'));
}
String name = node.getNameWithoutPackage();

if (node instanceof InnerClassNode) {
@@ -686,7 +686,7 @@ private GroovyClassDoc resolveInternalClassDocFromImport(GroovyRootDoc rootDoc,
GroovyClassDoc doc = ((SimpleGroovyRootDoc)rootDoc).classNamedExact(importName);
if (doc != null) return doc;
} else if (importName.endsWith("/*")) {
GroovyClassDoc doc = ((SimpleGroovyRootDoc)rootDoc).classNamedExact(importName.substring(0, importName.length() - 2) + baseName);
GroovyClassDoc doc = ((SimpleGroovyRootDoc)rootDoc).classNamedExact(importName.substring(0, importName.length() - 1) + baseName);
if (doc != null) return doc;
}
}
@@ -82,6 +82,7 @@ public void visit(ImportDeclaration n, Object arg) {
String qual = qualPath.map(value -> value.asString().replace('.', '/') + "/").orElse("");
String id = n.getName().getIdentifier();
String name = qual + id;
if (n.isAsterisk()) name +="/*";
imports.add(name);
aliases.put(id, name);
super.visit(n, arg);

0 comments on commit 7926dd8

Please sign in to comment.