added memoization to config lookup in eclipse. This should help make it (much) faster.

This commit is contained in:
Reinier Zwitserloot committed 2014-09-02 23:11:23 +02:00
1 parent 071fa6835a
commit 3131e93b92
1 file changed
+11
+11
View File
@@ -70,7 +70,18 @@ public class EclipseAST extends AST<EclipseAST, EclipseNode, ASTNode> {
}
private static volatile boolean skipEclipseWorkspaceBasedFileResolver = false;
private static final URI NOT_CALCULATED_MARKER = URI.create("http://projectlombok.org/not/calculated");
private URI memoizedAbsoluteFileLocation = NOT_CALCULATED_MARKER;
public URI getAbsoluteFileLocation() {
if (memoizedAbsoluteFileLocation != NOT_CALCULATED_MARKER) return memoizedAbsoluteFileLocation;
memoizedAbsoluteFileLocation = getAbsoluteFileLocation0();
return memoizedAbsoluteFileLocation;
}
/** This is the call, but we wrapped it to memoize this. */
private URI getAbsoluteFileLocation0() {
String fileName = getFileName();
if (fileName != null && (fileName.startsWith("file:") || fileName.startsWith("sourcecontrol:"))) {
// Some exotic build systems get real fancy with filenames. Known culprits: