aboutsummaryrefslogtreecommitdiff
path: root/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2010-08-15 22:59:49 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2010-08-15 22:59:49 +0200
commit240473a6c214679362bb3544ea414716f4c2062a (patch)
treee06ebd0e412cd8454ad1649d94c5e0919c4fa76e /src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
parent81cfc844b90d347c01ec9e68dcd7554a75caa733 (diff)
parent4c23804837e854c4f4ebb0008b10241467550d3f (diff)
downloadlombok-240473a6c214679362bb3544ea414716f4c2062a.tar.gz
lombok-240473a6c214679362bb3544ea414716f4c2062a.tar.bz2
lombok-240473a6c214679362bb3544ea414716f4c2062a.zip
Merge branch 'postProcess'
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java')
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
index 1486c608..2ac24a48 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
@@ -64,11 +64,40 @@ public class EclipsePatcher extends Agent {
patchSetGeneratedFlag(sm);
patchHideGeneratedNodes(sm);
patchLiveDebug(sm);
+ patchPostCompileHookEclipse(sm);
+ } else {
+ patchPostCompileHookEcj(sm);
}
if (reloadExistingClasses) sm.reloadClasses(instrumentation);
}
+ private static void patchPostCompileHookEclipse(ScriptManager sm) {
+ sm.addScript(ScriptBuilder.wrapMethodCall()
+ .target(new MethodTarget("org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder", "writeClassFileContents"))
+ .target(new MethodTarget("org.eclipse.jdt.internal.core.builder.AbstractImageBuilder", "writeClassFileContents"))
+ .methodToWrap(new Hook("org.eclipse.jdt.internal.compiler.ClassFile", "getBytes", "byte[]"))
+ .wrapMethod(new Hook("lombok.eclipse.agent.PatchFixes", "runPostCompiler", "byte[]", "byte[]", "java.lang.String"))
+ .requestExtra(StackRequest.PARAM3)
+ .transplant()
+ .build());
+ }
+
+ private static void patchPostCompileHookEcj(ScriptManager sm) {
+ sm.addScript(ScriptBuilder.wrapMethodCall()
+ .target(new MethodTarget("org.eclipse.jdt.internal.compiler.tool.EclipseCompilerImpl", "outputClassFiles"))
+ .methodToWrap(new Hook("javax.tools.JavaFileObject", "openOutputStream", "java.io.OutputStream"))
+ .wrapMethod(new Hook("lombok.eclipse.agent.PatchFixes", "runPostCompiler", "java.io.OutputStream", "java.io.OutputStream"))
+ .build());
+
+ sm.addScript(ScriptBuilder.wrapMethodCall()
+ .target(new MethodTarget("org.eclipse.jdt.internal.compiler.util.Util", "writeToDisk"))
+ .methodToWrap(new Hook("java.io.BufferedOutputStream", "<init>", "void", "java.io.OutputStream", "int"))
+ .wrapMethod(new Hook("lombok.eclipse.agent.PatchFixes", "runPostCompiler", "java.io.BufferedOutputStream", "java.io.BufferedOutputStream", "java.lang.String", "java.lang.String"))
+ .requestExtra(StackRequest.PARAM2, StackRequest.PARAM3)
+ .build());
+ }
+
private static void patchHideGeneratedNodes(ScriptManager sm) {
sm.addScript(ScriptBuilder.wrapReturnValue()
.target(new MethodTarget("org.eclipse.jdt.internal.corext.dom.LinkedNodeFinder", "findByNode"))