diff options
Diffstat (limited to 'src/eclipseAgent/lombok')
4 files changed, 19 insertions, 15 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); } diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java index e92ed674..b90d5762 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java +++ b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java @@ -22,7 +22,7 @@ package lombok.eclipse.agent; import static lombok.eclipse.Eclipse.*; -import static lombok.eclipse.EclipseAugments.*; +import static lombok.eclipse.EcjAugments.*; import static lombok.eclipse.handlers.EclipseHandlerUtil.*; import java.lang.reflect.Method; @@ -724,7 +724,7 @@ public class PatchDelegate { private static void cleanupDelegateMethods(CompilationUnitDeclaration cud) { CompilationUnit compilationUnit = getCompilationUnit(cud); if (compilationUnit != null) { - CompilationUnit_delegateMethods.clear(compilationUnit); + EclipseAugments.CompilationUnit_delegateMethods.clear(compilationUnit); } } @@ -819,7 +819,7 @@ public class PatchDelegate { if (sourceType != null) { CompilationUnit compilationUnit = getCompilationUnit(sourceType.getCompilationUnit()); if (compilationUnit != null) { - ConcurrentMap<String, List<SourceMethod>> map = CompilationUnit_delegateMethods.setIfAbsent(compilationUnit, new ConcurrentHashMap<String, List<SourceMethod>>()); + ConcurrentMap<String, List<SourceMethod>> map = EclipseAugments.CompilationUnit_delegateMethods.setIfAbsent(compilationUnit, new ConcurrentHashMap<String, List<SourceMethod>>()); List<SourceMethod> newList = new ArrayList<SourceMethod>(); List<SourceMethod> oldList = map.putIfAbsent(sourceType.getTypeQualifiedName(), newList); return oldList != null ? oldList : newList; diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java b/src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java index a91e4d8b..19a0383a 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java +++ b/src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java @@ -21,7 +21,7 @@ */ package lombok.eclipse.agent; -import static lombok.eclipse.EclipseAugments.CompilationUnit_javadoc; +import static lombok.eclipse.EcjAugments.EclipseAugments.CompilationUnit_javadoc; import java.lang.reflect.Method; import java.util.Map; @@ -36,7 +36,6 @@ import org.eclipse.jdt.internal.core.CompilationUnit; import org.eclipse.jdt.internal.core.SourceMethod; import org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2; -import lombok.eclipse.EclipseAugments; import lombok.eclipse.handlers.EclipseHandlerUtil; import lombok.permit.Permit; @@ -52,7 +51,7 @@ public class PatchJavadoc { ICompilationUnit iCompilationUnit = sourceMethod.getCompilationUnit(); if (iCompilationUnit instanceof CompilationUnit) { CompilationUnit compilationUnit = (CompilationUnit) iCompilationUnit; - Map<String, String> docs = EclipseAugments.CompilationUnit_javadoc.get(compilationUnit); + Map<String, String> docs = CompilationUnit_javadoc.get(compilationUnit); String signature = getSignature(sourceMethod); String rawJavadoc = docs.get(signature); @@ -80,7 +79,7 @@ public class PatchJavadoc { } return methodDeclaration.print(tab, output); } - + private static String getSignature(SourceMethod sourceMethod) { StringBuilder sb = new StringBuilder(); sb.append(sourceMethod.getParent().getElementName()); diff --git a/src/eclipseAgent/lombok/launch/PatchFixesHider.java b/src/eclipseAgent/lombok/launch/PatchFixesHider.java index a2cda66c..55e8e0bf 100755 --- a/src/eclipseAgent/lombok/launch/PatchFixesHider.java +++ b/src/eclipseAgent/lombok/launch/PatchFixesHider.java @@ -66,7 +66,7 @@ import org.eclipse.jdt.internal.core.dom.rewrite.TokenScanner; import org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.internal.corext.refactoring.structure.ASTNodeSearchUtil; -import lombok.eclipse.EclipseAugments; +import static lombok.eclipse.EcjAugments.ASTNode_generatedBy; /** These contain a mix of the following: * <ul> @@ -545,14 +545,14 @@ final class PatchFixesHider { public static int fixRetrieveRightBraceOrSemiColonPosition(int retVal, AbstractMethodDeclaration amd) { if (retVal != -1 || amd == null) return retVal; - boolean isGenerated = EclipseAugments.ASTNode_generatedBy.get(amd) != null; + boolean isGenerated = ASTNode_generatedBy.get(amd) != null; if (isGenerated) return amd.declarationSourceEnd; return -1; } public static int fixRetrieveRightBraceOrSemiColonPosition(int retVal, FieldDeclaration fd) { if (retVal != -1 || fd == null) return retVal; - boolean isGenerated = EclipseAugments.ASTNode_generatedBy.get(fd) != null; + boolean isGenerated = ASTNode_generatedBy.get(fd) != null; if (isGenerated) return fd.declarationSourceEnd; return -1; } @@ -578,13 +578,13 @@ final class PatchFixesHider { org.eclipse.jdt.internal.compiler.ast.ASTNode internalNode) throws Exception { if (internalNode == null || domNode == null) return; - boolean isGenerated = EclipseAugments.ASTNode_generatedBy.get(internalNode) != null; + boolean isGenerated = ASTNode_generatedBy.get(internalNode) != null; if (isGenerated) domNode.getClass().getField("$isGenerated").set(domNode, true); } public static void setIsGeneratedFlagForName(org.eclipse.jdt.core.dom.Name name, Object internalNode) throws Exception { if (internalNode instanceof org.eclipse.jdt.internal.compiler.ast.ASTNode) { - boolean isGenerated = EclipseAugments.ASTNode_generatedBy.get((org.eclipse.jdt.internal.compiler.ast.ASTNode) internalNode) != null; + boolean isGenerated = ASTNode_generatedBy.get((org.eclipse.jdt.internal.compiler.ast.ASTNode) internalNode) != null; if (isGenerated) name.getClass().getField("$isGenerated").set(name, true); } } |