aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2016-11-07 23:26:39 +0100
committerRoel Spilker <r.spilker@gmail.com>2016-11-07 23:26:39 +0100
commit192c569128d1ffb879fb104f44483e394032a790 (patch)
tree28e3d27ac0105cae0638998c3b086e83b7539da8
parent49f0bc1c3ede3c81754568af22fcdbbe8f4b5a8f (diff)
downloadlombok-192c569128d1ffb879fb104f44483e394032a790.tar.gz
lombok-192c569128d1ffb879fb104f44483e394032a790.tar.bz2
lombok-192c569128d1ffb879fb104f44483e394032a790.zip
[issue #1218] Annotation Processors that have an (internal) dependency on ecj (google's dagger project has this, don't know of any others), when run inside eclipse, bombs with a LinkageError. Fixed.
-rw-r--r--buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.22.xml (renamed from buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.20.xml)4
-rw-r--r--buildScripts/ivy.xml2
-rw-r--r--doc/changelog.markdown1
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java12
4 files changed, 16 insertions, 3 deletions
diff --git a/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.20.xml b/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.22.xml
index f8ddcb51..85e2f9ef 100644
--- a/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.20.xml
+++ b/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.22.xml
@@ -1,5 +1,5 @@
<ivy-module version="2.0">
- <info organisation="org.projectlombok" module="lombok.patcher" revision="0.20" publication="20150408000000">
+ <info organisation="org.projectlombok" module="lombok.patcher" revision="0.22" publication="20161107000000">
<license name="MIT License" url="http://www.opensource.org/licenses/mit-license.php" />
<ivyauthor name="rzwitserloot" url="http://zwitserloot.com/" />
<ivyauthor name="rspilker" url="http://github.com/rspilker" />
@@ -9,6 +9,6 @@
<conf name="default" />
</configurations>
<publications>
- <artifact conf="default" url="https://projectlombok.org/downloads/lombok.patcher-0.20.jar" />
+ <artifact conf="default" url="https://projectlombok.org/downloads/lombok.patcher-0.22.jar" />
</publications>
</ivy-module>
diff --git a/buildScripts/ivy.xml b/buildScripts/ivy.xml
index e0066ae4..3a851fcd 100644
--- a/buildScripts/ivy.xml
+++ b/buildScripts/ivy.xml
@@ -15,7 +15,7 @@
<conf name="javac7" />
</configurations>
<dependencies>
- <dependency org="org.projectlombok" name="lombok.patcher" rev="0.20" conf="buildBase->default; runtime->default" />
+ <dependency org="org.projectlombok" name="lombok.patcher" rev="0.22" conf="buildBase->default; runtime->default" />
<dependency org="zwitserloot.com" name="cmdreader" rev="1.2" conf="buildBase->runtime; runtime" />
<dependency org="junit" name="junit" rev="4.8.2" conf="test->default; contrib->sources" />
diff --git a/doc/changelog.markdown b/doc/changelog.markdown
index 89df8709..474ca2f5 100644
--- a/doc/changelog.markdown
+++ b/doc/changelog.markdown
@@ -3,6 +3,7 @@ Lombok Changelog
### v1.16.11 "Edgy Guinea Pig"
* v1.16.10 is the latest release
+* BUGFIX: Annotation Processors that use ecj internally (dagger) no longer give linkage errors [Issue #1218](https://github.com/rzwitserloot/lombok/issues/1218)
* BUGFIX: `val` in lambda expressions now work as expected [Issue #911](https://github.com/rzwitserloot/lombok/issues/911)
* PLATFORM: Red Hat JBoss Developer Studio is now correctly identified by the installer [Issue #1164](https://github.com/rzwitserloot/lombok/issues/1164)
* BUGFIX: delombok: for-loops with initializers that are not local variables would be generated incorrectly [Issue #1076](https://github.com/rzwitserloot/lombok/issues/1076)
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
index 7c538b6f..4b18dc0f 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
@@ -24,11 +24,14 @@ package lombok.eclipse.agent;
import static lombok.patcher.scripts.ScriptBuilder.*;
import java.lang.instrument.Instrumentation;
+import java.net.URLClassLoader;
+import java.security.ProtectionDomain;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import lombok.core.AgentLauncher;
+import lombok.patcher.Filter;
import lombok.patcher.Hook;
import lombok.patcher.MethodTarget;
import lombok.patcher.ScriptManager;
@@ -74,6 +77,15 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable {
private static void registerPatchScripts(Instrumentation instrumentation, boolean reloadExistingClasses, boolean ecjOnly, Class<?> launchingContext) {
ScriptManager sm = new ScriptManager();
sm.registerTransformer(instrumentation);
+ sm.setFilter(new Filter() {
+ @Override public boolean shouldTransform(ClassLoader loader, String className, Class<?> classBeingDefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) {
+ if (!(loader instanceof URLClassLoader)) return true;
+ ClassLoader parent = loader.getParent();
+ if (parent == null) return true;
+ return !parent.getClass().getName().startsWith("org.eclipse.jdt.apt.core.internal.AnnotationProcessorFactoryLoader");
+ }
+ });
+
final boolean forceBaseResourceNames = !"".equals(System.getProperty("shadow.override.lombok", ""));
sm.setTransplantMapper(new TransplantMapper() {
public String mapResourceName(int classFileFormatVersion, String resourceName) {