mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-15 12:14:31 +00:00
[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
This commit is contained in:
1 parent
92aa6854fa
commit
c709f8b949
1 file changed
+11
-1
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user