From 199f7f74fd35462dced087280af066cf2cad7596 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 1 Dec 2009 13:53:07 +0100 Subject: Generalized the agent mechanism; now 1 lombok.jar can serve as the agent for BOTH netbeans AND eclipse, and is future-ready for an IntelliJ agent. --- src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java') diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java index 7d2a28bc..741328f1 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java +++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java @@ -26,6 +26,7 @@ import java.util.Collection; import java.util.Collections; import java.util.List; +import lombok.core.Agent; import lombok.patcher.Hook; import lombok.patcher.MethodTarget; import lombok.patcher.ScriptManager; @@ -41,15 +42,10 @@ import lombok.patcher.scripts.ScriptBuilder; * classes in this package for more information about which classes are transformed and how they are * transformed. */ -public class EclipsePatcher { - private EclipsePatcher() {} - - public static void agentmain(@SuppressWarnings("unused") String agentArgs, Instrumentation instrumentation) throws Exception { - registerPatchScripts(instrumentation, true); - } - - public static void premain(@SuppressWarnings("unused") String agentArgs, Instrumentation instrumentation) throws Exception { - registerPatchScripts(instrumentation, false); +public class EclipsePatcher extends Agent { + @Override + public void runAgent(String agentArgs, Instrumentation instrumentation, boolean injected) throws Exception { + registerPatchScripts(instrumentation, injected); } private static void registerPatchScripts(Instrumentation instrumentation, boolean reloadExistingClasses) { -- cgit