You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by cc...@apache.org on 2018/05/23 19:30:40 UTC
[5/9] groovy git commit: Implement a bit smarter lookup
Implement a bit smarter lookup
The code isn't really clear what the inputs/outputs are, so it's
just reordering things to make it faster.
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/cdca9615
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/cdca9615
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/cdca9615
Branch: refs/heads/GROOVY_2_6_X
Commit: cdca9615bfff293d2e37d3447b8787370d214cd7
Parents: b0f4223
Author: Cedric Champeau <cc...@apache.org>
Authored: Wed May 23 09:59:59 2018 +0200
Committer: Cedric Champeau <cc...@apache.org>
Committed: Wed May 23 21:30:26 2018 +0200
----------------------------------------------------------------------
.../groovy/tools/groovydoc/SimpleGroovyRootDoc.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/cdca9615/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyRootDoc.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyRootDoc.java b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyRootDoc.java
index 661ff92..3748907 100644
--- a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyRootDoc.java
+++ b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyRootDoc.java
@@ -55,16 +55,17 @@ public class SimpleGroovyRootDoc extends SimpleGroovyDoc implements GroovyRootDo
return doc;
}
// look for full match or match excluding package
+ String fullPathName = groovyClassDoc != null ? groovyClassDoc.getFullPathName() : null;
+ boolean hasPackage = (fullPathName != null && fullPathName.lastIndexOf('/') > 0);
+ if (hasPackage) {
+ fullPathName = fullPathName.substring(0, fullPathName.lastIndexOf('/'));
+ }
+
for (Map.Entry<String, GroovyClassDoc> entry : classDocs.entrySet()) {
String key = entry.getKey();
int lastSlashIdx = key.lastIndexOf('/');
if (lastSlashIdx > 0) {
String shortKey = key.substring(lastSlashIdx + 1);
- String fullPathName = groovyClassDoc != null ? groovyClassDoc.getFullPathName() : null;
-
- boolean hasPackage = (fullPathName != null && fullPathName.lastIndexOf('/') > 0);
- if (hasPackage) fullPathName = fullPathName.substring(0, fullPathName.lastIndexOf('/'));
-
if (shortKey.equals(name) && (!hasPackage || key.startsWith(fullPathName))) {
return entry.getValue();
}