aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Dreis <christoph.dreis@freenet.de>2023-02-22 14:03:58 +0100
committerChristoph Dreis <christoph.dreis@freenet.de>2023-02-22 14:03:58 +0100
commitea0fbd8ca511ae3ab336b166b34b273a8b2c1366 (patch)
treef45a396aaaab3bc5f054c6dc6d94aafea701abe5
parente5c324c615c1e304b2a9a64bc7f8608a67b0a74e (diff)
downloadlombok-ea0fbd8ca511ae3ab336b166b34b273a8b2c1366.tar.gz
lombok-ea0fbd8ca511ae3ab336b166b34b273a8b2c1366.tar.bz2
lombok-ea0fbd8ca511ae3ab336b166b34b273a8b2c1366.zip
Cache ConfigurationFile.parent()
-rw-r--r--src/core/lombok/core/configuration/ConfigurationFile.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/lombok/core/configuration/ConfigurationFile.java b/src/core/lombok/core/configuration/ConfigurationFile.java
index 9a5e97e3..8e4e687c 100644
--- a/src/core/lombok/core/configuration/ConfigurationFile.java
+++ b/src/core/lombok/core/configuration/ConfigurationFile.java
@@ -110,7 +110,8 @@ public abstract class ConfigurationFile {
private static class RegularConfigurationFile extends ConfigurationFile {
private final File file;
-
+ private ConfigurationFile parent;
+
private RegularConfigurationFile(File file) {
super(file.getPath());
this.file = file;
@@ -173,8 +174,11 @@ public abstract class ConfigurationFile {
}
@Override ConfigurationFile parent() {
- File parent = file.getParentFile().getParentFile();
- return parent == null ? null : forDirectory(parent);
+ if (parent == null) {
+ File parentFile = file.getParentFile().getParentFile();
+ parent = parentFile == null ? null : forDirectory(parentFile);
+ }
+ return parent;
}
private static String replaceEnvironmentVariables(String fileName) {