diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2020-10-03 23:51:33 +0200 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2020-10-03 23:51:33 +0200 |
commit | 1b534d17d39f687d42ebab733327a59c3466a949 (patch) | |
tree | d24e04a9c95b0caa0df855fb5d20b63730fc7707 /src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java | |
parent | eadd3b8ccea16d46249e6b01c4ac4b295c691abd (diff) | |
download | lombok-1b534d17d39f687d42ebab733327a59c3466a949.tar.gz lombok-1b534d17d39f687d42ebab733327a59c3466a949.tar.bz2 lombok-1b534d17d39f687d42ebab733327a59c3466a949.zip |
Untangling patches to classes that only exist in eclipse, not ecj
Specifically, Rawi01's patches to make javadoc behaviour in eclipse better,
which cannot be applied to ecj as you get load errors (javadoc not a thing there).
As part of this commit, tests can be limited to ecj or eclipse, and I made cut-down
versions of a few tests (to run on ecj, as the main one cannot be, due to javadoc issues).
The tests now marked as eclipse only don't fail on ecj, but they don't generate the same
result. Alternatively, we could go with a separated out after-ecj and after-eclipse dir
instead, but that's perhaps going overboard.
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java')
-rw-r--r-- | src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java index 3412000e..75263bdd 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java +++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java @@ -50,8 +50,7 @@ import lombok.patcher.scripts.ScriptBuilder; */ public class EclipsePatcher implements AgentLauncher.AgentLaunchable { // At some point I'd like the agent to be capable of auto-detecting if its on eclipse or on ecj. This class is a sure sign we're not in ecj but in eclipse. -ReinierZ - @SuppressWarnings("unused") - private static final String ECLIPSE_SIGNATURE_CLASS = "org/eclipse/core/runtime/adaptor/EclipseStarter"; + private static final String ECLIPSE_SIGNATURE_CLASS = "org.eclipse.core.runtime.adaptor.EclipseStarter"; @Override public void runAgent(String agentArgs, Instrumentation instrumentation, boolean injected, Class<?> launchingContext) throws Exception { String[] args = agentArgs == null ? new String[0] : agentArgs.split(":"); @@ -73,6 +72,12 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable { else if (forceEclipse) ecj = false; else ecj = injected; + if (!ecj) try { + Class.forName(ECLIPSE_SIGNATURE_CLASS); + } catch (ClassNotFoundException e) { + ecj = true; + } + registerPatchScripts(instrumentation, injected, ecj, launchingContext); } @@ -117,6 +122,7 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable { patchExtractInterface(sm); patchAboutDialog(sm); patchEclipseDebugPatches(sm); + patchJavadoc(sm); } else { patchPostCompileHookEcj(sm); } @@ -127,7 +133,6 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable { patchExtensionMethod(sm, ecjOnly); patchRenameField(sm); patchNullCheck(sm); - patchJavadoc(sm); if (reloadExistingClasses) sm.reloadClasses(instrumentation); } |