aboutsummaryrefslogtreecommitdiff
path: root/src/eclipseAgent/lombok/eclipse
diff options
context:
space:
mode:
authorRawi01 <Rawi01@users.noreply.github.com>2021-09-23 18:09:07 +0200
committerRawi01 <Rawi01@users.noreply.github.com>2021-09-28 22:02:17 +0200
commit07cf64ed66416a4eaa5f6bf8216f307c62dbb0dc (patch)
treefc87c3d9d7e1967b1a74ff34b5105a5261a0348b /src/eclipseAgent/lombok/eclipse
parentb50aa64f726952723b1a794538d9bb63fc43832d (diff)
downloadlombok-07cf64ed66416a4eaa5f6bf8216f307c62dbb0dc.tar.gz
lombok-07cf64ed66416a4eaa5f6bf8216f307c62dbb0dc.tar.bz2
lombok-07cf64ed66416a4eaa5f6bf8216f307c62dbb0dc.zip
Support javadoc copying in ecj language server
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse')
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java8
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java16
2 files changed, 22 insertions, 2 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
index 05d77b37..fe1c8608 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
@@ -892,6 +892,14 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable {
.requestExtra(StackRequest.PARAM1)
.build());
+ /* This is a copy for the language server implementation that also supports markdown */
+ sm.addScript(ScriptBuilder.wrapMethodCall()
+ .target(new MethodTarget("org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2", "getHTMLContent", "java.lang.String", "org.eclipse.jdt.core.IJavaElement", "boolean"))
+ .methodToWrap(new Hook("org.eclipse.jdt.ls.core.internal.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.addScriptIfWitness(OSGI_TYPES, ScriptBuilder.wrapMethodCall()
.target(new MethodTarget("org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2", "getHTMLContent", "java.lang.String", "org.eclipse.jdt.core.IMember", "boolean"))
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java b/src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java
index 5b34917e..673c30fd 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchJavadoc.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2020 The Project Lombok Authors.
+ * Copyright (C) 2020-2021 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -103,8 +103,9 @@ public class PatchJavadoc {
private static class Reflection {
private static final Method javadoc2HTML;
private static final Method oldJavadoc2HTML;
+ private static final Method lsJavadoc2HTML;
static {
- Method a = null, b = null;
+ Method a = null, b = null, c = null;
try {
a = Permit.getMethod(JavadocContentAccess2.class, "javadoc2HTML", IMember.class, IJavaElement.class, String.class);
@@ -112,9 +113,13 @@ public class PatchJavadoc {
try {
b = Permit.getMethod(JavadocContentAccess2.class, "javadoc2HTML", IMember.class, String.class);
} catch (Throwable t) {}
+ try {
+ c = Permit.getMethod(Class.forName("org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2"), "javadoc2HTML", IMember.class, IJavaElement.class, String.class);
+ } catch (Throwable t) {}
javadoc2HTML = a;
oldJavadoc2HTML = b;
+ lsJavadoc2HTML = c;
}
private static String javadoc2HTML(IMember member, IJavaElement element, String rawJavadoc) {
@@ -125,6 +130,13 @@ public class PatchJavadoc {
return null;
}
}
+ if (lsJavadoc2HTML != null) {
+ try {
+ return (String) lsJavadoc2HTML.invoke(null, member, element, rawJavadoc);
+ } catch (Throwable t) {
+ return null;
+ }
+ }
if (oldJavadoc2HTML != null) {
try {
return (String) oldJavadoc2HTML.invoke(null, member, rawJavadoc);