diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2023-03-21 17:39:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-21 17:39:34 +0100 |
commit | 79c5d2dfd3aa5ccdcf164abaff7dc53f55844dbf (patch) | |
tree | 6b810117cda4a55e2ec300b51ac1ce989172f138 | |
parent | e64c6b5879d36d45ec6a768ff907b7857a2ee217 (diff) | |
parent | ea0fbd8ca511ae3ab336b166b34b273a8b2c1366 (diff) | |
download | lombok-79c5d2dfd3aa5ccdcf164abaff7dc53f55844dbf.tar.gz lombok-79c5d2dfd3aa5ccdcf164abaff7dc53f55844dbf.tar.bz2 lombok-79c5d2dfd3aa5ccdcf164abaff7dc53f55844dbf.zip |
Merge pull request #3358 from dreis2211/config-parent-cache
Cache ConfigurationFile.parent()
-rw-r--r-- | src/core/lombok/core/configuration/ConfigurationFile.java | 10 |
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) { |