mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 04:16:19 +00:00
Cache absolute file location
This commit is contained in:
1 parent
4e359da7cc
commit
2917a8c5e1
1 file changed
+6
-1
@@ -79,6 +79,8 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> {
|
||||
private final Log log;
|
||||
private final ErrorLog errorLogger;
|
||||
private final Context context;
|
||||
private static final URI NOT_CALCULATED_MARKER = URI.create("https://projectlombok.org/not/calculated");
|
||||
private URI memoizedAbsoluteFileLocation = NOT_CALCULATED_MARKER;
|
||||
|
||||
/**
|
||||
* Creates a new JavacAST of the provided Compilation Unit.
|
||||
@@ -102,7 +104,10 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> {
|
||||
}
|
||||
|
||||
@Override public URI getAbsoluteFileLocation() {
|
||||
return getAbsoluteFileLocation((JCCompilationUnit) top().get());
|
||||
if (memoizedAbsoluteFileLocation == NOT_CALCULATED_MARKER) {
|
||||
memoizedAbsoluteFileLocation = getAbsoluteFileLocation((JCCompilationUnit) top().get());
|
||||
}
|
||||
return memoizedAbsoluteFileLocation;
|
||||
}
|
||||
|
||||
public static URI getAbsoluteFileLocation(JCCompilationUnit cu) {
|
||||
|
||||
Reference in new issue
Block a user