diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-03-27 22:17:05 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-03-27 22:17:17 +0200 |
commit | c709f8b949c83a50e734372b1acea697839f7c9e (patch) | |
tree | be3021c4145b4ebcc31c61c1a38b5d3f4bdc6e9c /src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java | |
parent | 92aa6854fa54e11607ff4c1c7fe18a4aa1607494 (diff) | |
download | lombok-c709f8b949c83a50e734372b1acea697839f7c9e.tar.gz lombok-c709f8b949c83a50e734372b1acea697839f7c9e.tar.bz2 lombok-c709f8b949c83a50e734372b1acea697839f7c9e.zip |
[trivial] eclipse patches are loaded from Class50 even if you override the shadowloader classpath, but only if you have lombok.jar in there. This solves exotic problems if you try to add some features to lombok in a separate jar, and addresses issue #1523
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java')
-rw-r--r-- | src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java index 135b5c77..33d7a496 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java +++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java @@ -23,6 +23,7 @@ package lombok.eclipse.agent; import static lombok.patcher.scripts.ScriptBuilder.*; +import java.io.File; import java.lang.instrument.Instrumentation; import java.net.URLClassLoader; import java.security.ProtectionDomain; @@ -86,7 +87,7 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable { } }); - final boolean forceBaseResourceNames = !"".equals(System.getProperty("shadow.override.lombok", "")); + final boolean forceBaseResourceNames = shouldForceBaseResourceNames(); sm.setTransplantMapper(new TransplantMapper() { public String mapResourceName(int classFileFormatVersion, String resourceName) { if (classFileFormatVersion < 50 || forceBaseResourceNames) return resourceName; @@ -125,6 +126,15 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable { if (reloadExistingClasses) sm.reloadClasses(instrumentation); } + private static boolean shouldForceBaseResourceNames() { + String shadowOverride = System.getProperty("shadow.override.lombok", ""); + if (shadowOverride == null || shadowOverride.length() == 0) return false; + for (String part : shadowOverride.split("\\s*" + (File.pathSeparatorChar == ';' ? ";" : ":") + "\\s*")) { + if (part.equalsIgnoreCase("lombok.jar")) return false; + } + return true; + } + private static void patchRenameField(ScriptManager sm) { /* RefactoringSearchEngine.search will not return results when renaming field and Data Annotation is present. Return a fake Element to make checks pass */ sm.addScript(ScriptBuilder.wrapMethodCall() |