aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2014-09-02 23:11:23 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2014-09-02 23:11:23 +0200
commit3131e93b925f06f183965ef72690d01810b5873e (patch)
tree433626867daeedd235f997cc239acf3f14b476d7
parent071fa6835a32d32482945c61a190c608cd2a0ca0 (diff)
downloadlombok-3131e93b925f06f183965ef72690d01810b5873e.tar.gz
lombok-3131e93b925f06f183965ef72690d01810b5873e.tar.bz2
lombok-3131e93b925f06f183965ef72690d01810b5873e.zip
added memoization to config lookup in eclipse. This should help make it (much) faster.
-rw-r--r--src/core/lombok/eclipse/EclipseAST.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/lombok/eclipse/EclipseAST.java b/src/core/lombok/eclipse/EclipseAST.java
index 5723668b..6df5c4d7 100644
--- a/src/core/lombok/eclipse/EclipseAST.java
+++ b/src/core/lombok/eclipse/EclipseAST.java
@@ -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: