diff options
Diffstat (limited to 'src/eclipseAgent')
-rw-r--r-- | src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java | 2 | ||||
-rw-r--r-- | src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java | 49 | ||||
-rwxr-xr-x | src/eclipseAgent/lombok/launch/PatchFixesHider.java | 2 |
3 files changed, 26 insertions, 27 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java index d5077b86..171fa8a9 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java +++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java @@ -916,7 +916,7 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable { .requestExtra(StackRequest.PARAM1) .build()); - sm.addScriptIfWitness(OSGI_TYPES, ScriptBuilder.replaceMethodCall() + sm.addScript(ScriptBuilder.replaceMethodCall() .target(new MethodTarget("org.eclipse.jdt.internal.compiler.ast.TypeDeclaration", "printBody", "java.lang.StringBuffer", "int", "java.lang.StringBuffer")) .methodToReplace(new Hook("org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration", "print", "java.lang.StringBuffer", "int", "java.lang.StringBuffer")) .replacementMethod(new Hook("lombok.launch.PatchFixesHider$Javadoc", "printMethod", "java.lang.StringBuffer", "org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration", "int", "java.lang.StringBuffer", "org.eclipse.jdt.internal.compiler.ast.TypeDeclaration")) diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java b/src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java index f5678154..5b34917e 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.EcjAugments.EclipseAugments.CompilationUnit_javadoc; +import static lombok.eclipse.EcjAugments.CompilationUnit_javadoc; import java.lang.reflect.Method; import java.util.Map; @@ -41,7 +41,7 @@ import lombok.permit.Permit; public class PatchJavadoc { - public static String getHTMLContentFromSource(String original, IJavaElement member) { + public static String getHTMLContentFromSource(String original, Object member) { if (original != null) { return original; } @@ -51,15 +51,14 @@ public class PatchJavadoc { ICompilationUnit iCompilationUnit = sourceMethod.getCompilationUnit(); if (iCompilationUnit instanceof CompilationUnit) { CompilationUnit compilationUnit = (CompilationUnit) iCompilationUnit; - Map<String, String> docs = CompilationUnit_javadoc.get(compilationUnit); if (docs == null) return null; - String signature = getSignature(sourceMethod); + String signature = Signature.getSignature(sourceMethod); String rawJavadoc = docs.get(signature); if (rawJavadoc == null) return null; - return Reflection.javadoc2HTML((IMember) member, member, rawJavadoc); + return Reflection.javadoc2HTML((IMember) member, (IJavaElement) member, rawJavadoc); } } @@ -67,33 +66,33 @@ public class PatchJavadoc { } public static StringBuffer printMethod(AbstractMethodDeclaration methodDeclaration, Integer tab, StringBuffer output, TypeDeclaration type) { - if (methodDeclaration.compilationResult.compilationUnit instanceof CompilationUnit) { - Map<String, String> docs = CompilationUnit_javadoc.get((CompilationUnit) methodDeclaration.compilationResult.compilationUnit); - if (docs != null) { - String signature = EclipseHandlerUtil.getSignature(type, methodDeclaration); - String rawJavadoc = docs.get(signature); - if (rawJavadoc != null) { - for (String line : rawJavadoc.split("\r?\n")) { - ASTNode.printIndent(tab, output).append(line).append("\n"); - } + Map<String, String> docs = CompilationUnit_javadoc.get(methodDeclaration.compilationResult.compilationUnit); + if (docs != null) { + String signature = EclipseHandlerUtil.getSignature(type, methodDeclaration); + String rawJavadoc = docs.get(signature); + if (rawJavadoc != null) { + for (String line : rawJavadoc.split("\r?\n")) { + ASTNode.printIndent(tab, output).append(line).append("\n"); } } } return methodDeclaration.print(tab, output); } - private static String getSignature(SourceMethod sourceMethod) { - StringBuilder sb = new StringBuilder(); - sb.append(sourceMethod.getParent().getElementName()); - sb.append("."); - sb.append(sourceMethod.getElementName()); - sb.append("("); - for (String type : sourceMethod.getParameterTypes()) { - sb.append(type); + private static class Signature { + static final String getSignature(SourceMethod sourceMethod) { + StringBuilder sb = new StringBuilder(); + sb.append(sourceMethod.getParent().getElementName()); + sb.append("."); + sb.append(sourceMethod.getElementName()); + sb.append("("); + for (String type : sourceMethod.getParameterTypes()) { + sb.append(org.eclipse.jdt.core.Signature.toString(type)); + } + sb.append(")"); + + return sb.toString(); } - sb.append(")"); - - return sb.toString(); } /** diff --git a/src/eclipseAgent/lombok/launch/PatchFixesHider.java b/src/eclipseAgent/lombok/launch/PatchFixesHider.java index 503b2b4a..e2d266c5 100755 --- a/src/eclipseAgent/lombok/launch/PatchFixesHider.java +++ b/src/eclipseAgent/lombok/launch/PatchFixesHider.java @@ -332,7 +332,7 @@ final class PatchFixesHider { static { Class<?> shadowed = Util.shadowLoadClass("lombok.eclipse.agent.PatchJavadoc"); - GET_HTML = Util.findMethod(shadowed, "getHTMLContentFromSource", String.class, IJavaElement.class); + GET_HTML = Util.findMethod(shadowed, "getHTMLContentFromSource", String.class, Object.class); PRINT_METHOD = Util.findMethod(shadowed, "printMethod", AbstractMethodDeclaration.class, Integer.class, StringBuffer.class, TypeDeclaration.class); } |