aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.xml13
-rw-r--r--buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.18.xml14
-rw-r--r--buildScripts/ivy.xml2
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/EclipseLoaderPatcher.java8
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/EclipseLoaderPatcherTransplants.java76
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java7
-rw-r--r--src/launch/lombok/launch/ShadowClassLoader.java4
7 files changed, 87 insertions, 37 deletions
diff --git a/build.xml b/build.xml
index 802c0335..d26b9e1e 100644
--- a/build.xml
+++ b/build.xml
@@ -190,6 +190,11 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<src path="build/transformedSources" />
</ivy:compile>
+ <ivy:compile destdir="build/lombok/Class50" source="1.4" target="1.6" includeantruntime="false">
+ <compilerarg value="-Xbootclasspath/p:build/stubs${path.separator}lib/openJDK6Environment/rt-openjdk6.jar" />
+ <src path="build/transformedSources" />
+ </ivy:compile>
+
<ivy:compile destdir="build/lombok" source="1.5" target="1.5" includeantruntime="false">
<compilerarg value="-Xbootclasspath/p:build/stubs${path.separator}lib/openJDK6Environment/rt-openjdk6.jar" />
<src path="src/launch" />
@@ -202,6 +207,14 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<classpath refid="build.path" />
</ivy:compile>
+ <ivy:compile destdir="build/lombok/Class50" source="1.5" target="1.6" includeantruntime="false">
+ <compilerarg value="-Xbootclasspath/p:build/stubs${path.separator}lib/openJDK6Environment/rt-openjdk6.jar" />
+ <src path="src/eclipseAgent" />
+ <include name="lombok/launch/PatchFixesHider.java" />
+ <classpath location="build/lombok" />
+ <classpath refid="build.path" />
+ </ivy:compile>
+
<ivy:compile destdir="build/lombok" source="1.6" target="1.6" includeantruntime="false">
<compilerarg value="-Xbootclasspath/p:build/stubs${path.separator}lib/openJDK6Environment/rt-openjdk6.jar" />
<src path="src/core" />
diff --git a/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.18.xml b/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.18.xml
new file mode 100644
index 00000000..410109e6
--- /dev/null
+++ b/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.18.xml
@@ -0,0 +1,14 @@
+<ivy-module version="2.0">
+ <info organisation="org.projectlombok" module="lombok.patcher" revision="0.18" publication="20150402000000">
+ <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" />
+ <description homepage="http://projectlombok.org/" />
+ </info>
+ <configurations>
+ <conf name="default" />
+ </configurations>
+ <publications>
+ <artifact conf="default" url="http://projectlombok.org/downloads/lombok.patcher-0.18.jar" />
+ </publications>
+</ivy-module>
diff --git a/buildScripts/ivy.xml b/buildScripts/ivy.xml
index 61fbbe2d..179fd0db 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.16" conf="buildBase->default; runtime->default" />
+ <dependency org="org.projectlombok" name="lombok.patcher" rev="0.18" 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/src/eclipseAgent/lombok/eclipse/agent/EclipseLoaderPatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipseLoaderPatcher.java
index c137cb46..aa01c13d 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/EclipseLoaderPatcher.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/EclipseLoaderPatcher.java
@@ -52,6 +52,14 @@ public class EclipseLoaderPatcher {
.targetClass("org.eclipse.osgi.internal.loader.ModuleClassLoader")
.build());
+ sm.addScript(ScriptBuilder.addField().setPublic().setVolatile().setStatic()
+ .fieldType("Ljava/lang/Class;")
+ .fieldName("lombok$shadowLoaderClass")
+ .targetClass("org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader")
+ .targetClass("org.eclipse.osgi.framework.adapter.core.AbstractClassLoader")
+ .targetClass("org.eclipse.osgi.internal.loader.ModuleClassLoader")
+ .build());
+
sm.addScript(ScriptBuilder.addField().setPublic().setStatic().setFinal()
.fieldType("Ljava/lang/String;")
.fieldName("lombok$location")
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipseLoaderPatcherTransplants.java b/src/eclipseAgent/lombok/eclipse/agent/EclipseLoaderPatcherTransplants.java
index b7268e01..b1327216 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/EclipseLoaderPatcherTransplants.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/EclipseLoaderPatcherTransplants.java
@@ -58,45 +58,49 @@ public class EclipseLoaderPatcherTransplants {
synchronized ("lombok$shadowLoader$globalLock".intern()) {
shadowLoader = (ClassLoader) shadowLoaderField.get(original);
if (shadowLoader == null) {
+ Class shadowClassLoaderClass = (Class) original.getClass().getField("lombok$shadowLoaderClass").get(null);
+ Class classLoaderClass = Class.forName("java.lang.ClassLoader");
String jarLoc = (String) original.getClass().getField("lombok$location").get(null);
- JarFile jf = new JarFile(jarLoc);
- InputStream in = null;
- try {
- ZipEntry entry = jf.getEntry("lombok/launch/ShadowClassLoader.class");
- in = jf.getInputStream(entry);
- byte[] bytes = new byte[65536];
- int len = 0;
- while (true) {
- int r = in.read(bytes, len, bytes.length - len);
- if (r == -1) break;
- len += r;
- if (len == bytes.length) throw new IllegalStateException("lombok.launch.ShadowClassLoader too large.");
+ if (shadowClassLoaderClass == null) {
+ JarFile jf = new JarFile(jarLoc);
+ InputStream in = null;
+ try {
+ ZipEntry entry = jf.getEntry("lombok/launch/ShadowClassLoader.class");
+ in = jf.getInputStream(entry);
+ byte[] bytes = new byte[65536];
+ int len = 0;
+ while (true) {
+ int r = in.read(bytes, len, bytes.length - len);
+ if (r == -1) break;
+ len += r;
+ if (len == bytes.length) throw new IllegalStateException("lombok.launch.ShadowClassLoader too large.");
+ }
+ in.close();
+ {
+ Class[] paramTypes = new Class[4];
+ paramTypes[0] = "".getClass();
+ paramTypes[1] = new byte[0].getClass();
+ paramTypes[2] = Integer.TYPE;
+ paramTypes[3] = paramTypes[2];
+ Method defineClassMethod = classLoaderClass.getDeclaredMethod("defineClass", paramTypes);
+ defineClassMethod.setAccessible(true);
+ shadowClassLoaderClass = (Class) defineClassMethod.invoke(original, new Object[] {"lombok.launch.ShadowClassLoader", bytes, new Integer(0), new Integer(len)});
+ original.getClass().getField("lombok$shadowLoaderClass").set(null, shadowClassLoaderClass);
+ }
+ } finally {
+ if (in != null) in.close();
+ jf.close();
}
- in.close();
- Class classLoaderClass = Class.forName("java.lang.ClassLoader");
- Class shadowClassLoaderClass; {
- Class[] paramTypes = new Class[4];
- paramTypes[0] = "".getClass();
- paramTypes[1] = new byte[0].getClass();
- paramTypes[2] = Integer.TYPE;
- paramTypes[3] = paramTypes[2];
- Method defineClassMethod = classLoaderClass.getDeclaredMethod("defineClass", paramTypes);
- defineClassMethod.setAccessible(true);
- shadowClassLoaderClass = (Class) defineClassMethod.invoke(original, new Object[] {"lombok.launch.ShadowClassLoader", bytes, new Integer(0), new Integer(len)});
- }
- Class[] paramTypes = new Class[4];
- paramTypes[0] = classLoaderClass;
- paramTypes[1] = "".getClass();
- paramTypes[2] = paramTypes[1];
- paramTypes[3] = new String[0].getClass();
- Constructor constructor = shadowClassLoaderClass.getDeclaredConstructor(paramTypes);
- constructor.setAccessible(true);
- shadowLoader = (ClassLoader) constructor.newInstance(new Object[] {original, "lombok", jarLoc, new String[] {"lombok."}});
- shadowLoaderField.set(original, shadowLoader);
- } finally {
- if (in != null) in.close();
- jf.close();
}
+ Class[] paramTypes = new Class[4];
+ paramTypes[0] = classLoaderClass;
+ paramTypes[1] = "".getClass();
+ paramTypes[2] = paramTypes[1];
+ paramTypes[3] = new String[0].getClass();
+ Constructor constructor = shadowClassLoaderClass.getDeclaredConstructor(paramTypes);
+ constructor.setAccessible(true);
+ shadowLoader = (ClassLoader) constructor.newInstance(new Object[] {original, "lombok", jarLoc, new String[] {"lombok."}});
+ shadowLoaderField.set(original, shadowLoader);
}
}
}
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
index b8e3a955..9906c4d4 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
@@ -34,6 +34,7 @@ import lombok.patcher.MethodTarget;
import lombok.patcher.ScriptManager;
import lombok.patcher.StackRequest;
import lombok.patcher.TargetMatcher;
+import lombok.patcher.TransplantMapper;
import lombok.patcher.scripts.ScriptBuilder;
/**
@@ -73,6 +74,12 @@ 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.setTransplantMapper(new TransplantMapper() {
+ public String getPrefixFor(int classFileFormatVersion) {
+ return classFileFormatVersion > 49 ? "Class50/" : "";
+ }
+ });
+
if (!ecjOnly) {
EclipseLoaderPatcher.patchEquinoxLoaders(sm, launchingContext);
patchCatchReparse(sm);
diff --git a/src/launch/lombok/launch/ShadowClassLoader.java b/src/launch/lombok/launch/ShadowClassLoader.java
index f8f969ef..8cfd5e39 100644
--- a/src/launch/lombok/launch/ShadowClassLoader.java
+++ b/src/launch/lombok/launch/ShadowClassLoader.java
@@ -79,6 +79,8 @@ import java.util.jar.JarFile;
*/
class ShadowClassLoader extends ClassLoader {
private static final String SELF_NAME = "lombok/launch/ShadowClassLoader.class";
+ private volatile static Class<?> lombokPatcherSymbols;
+
private final String SELF_BASE;
private final File SELF_BASE_FILE;
private final int SELF_BASE_LENGTH;
@@ -360,6 +362,7 @@ class ShadowClassLoader extends ClassLoader {
if (alreadyLoaded != null) return alreadyLoaded;
}
+ if (lombokPatcherSymbols != null && name.equals("lombok.patcher.Symbols")) return lombokPatcherSymbols;
String fileNameOfClass = name.replace(".", "/") + ".class";
URL res = getResource_(fileNameOfClass, true);
if (res == null) {
@@ -392,6 +395,7 @@ class ShadowClassLoader extends ClassLoader {
}
Class<?> c = defineClass(name, b, 0, p);
+ if (name.equals("lombok.patcher.Symbols")) lombokPatcherSymbols = c;
if (resolve) resolveClass(c);
return c;
}