aboutsummaryrefslogtreecommitdiff
path: root/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
diff options
context:
space:
mode:
authorRawi01 <Rawi01@users.noreply.github.com>2020-07-29 12:55:02 +0200
committerRawi01 <Rawi01@users.noreply.github.com>2020-07-29 13:39:42 +0200
commit2b4b5c983540af4a4c08cfb7a3d4057df0b84c39 (patch)
tree78a310e0f6d611d2113caf9a4b0a38889ac1926f /src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
parent7dfbe4323c15cbd88983380b27a250d2a381d148 (diff)
downloadlombok-2b4b5c983540af4a4c08cfb7a3d4057df0b84c39.tar.gz
lombok-2b4b5c983540af4a4c08cfb7a3d4057df0b84c39.tar.bz2
lombok-2b4b5c983540af4a4c08cfb7a3d4057df0b84c39.zip
Support javadoc copying in eclipse
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java')
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
index c560f002..6a271973 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
@@ -126,6 +126,7 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable {
patchExtensionMethod(sm, ecjOnly);
patchRenameField(sm);
patchNullCheck(sm);
+ patchJavadoc(sm);
if (reloadExistingClasses) sm.reloadClasses(instrumentation);
}
@@ -830,5 +831,37 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable {
.request(StackRequest.PARAM1)
.transplant().build());
}
+
+ private static void patchJavadoc(ScriptManager sm) {
+ sm.addScript(ScriptBuilder.wrapMethodCall()
+ .target(new MethodTarget("org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2", "getHTMLContent", "java.lang.String", "org.eclipse.jdt.core.IJavaElement", "boolean"))
+ .methodToWrap(new Hook("org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2", "getHTMLContentFromSource", "java.lang.String", "org.eclipse.jdt.core.IJavaElement"))
+ .wrapMethod(new Hook("lombok.launch.PatchFixesHider$Javadoc", "getHTMLContentFromSource", "java.lang.String", "java.lang.String", "org.eclipse.jdt.core.IJavaElement"))
+ .requestExtra(StackRequest.PARAM1)
+ .build());
+
+ /* This is an older version that uses IMember instead of IJavaElement */
+ sm.addScript(ScriptBuilder.wrapMethodCall()
+ .target(new MethodTarget("org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2", "getHTMLContent", "java.lang.String", "org.eclipse.jdt.core.IMember", "boolean"))
+ .methodToWrap(new Hook("org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2", "getHTMLContentFromSource", "java.lang.String", "org.eclipse.jdt.core.IMember"))
+ .wrapMethod(new Hook("lombok.launch.PatchFixesHider$Javadoc", "getHTMLContentFromSource", "java.lang.String", "java.lang.String", "org.eclipse.jdt.core.IJavaElement"))
+ .requestExtra(StackRequest.PARAM1)
+ .build());
+
+ 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"))
+ .requestExtra(StackRequest.THIS)
+ .build());
+
+ sm.addScript(ScriptBuilder.addField()
+ .fieldName("$javadoc")
+ .fieldType("Ljava/util/Map;")
+ .setPublic()
+ .setTransient()
+ .targetClass("org.eclipse.jdt.internal.core.CompilationUnit")
+ .build());
+ }
}