aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRawi01 <Rawi01@users.noreply.github.com>2020-02-26 09:05:16 +0100
committerRawi01 <Rawi01@users.noreply.github.com>2020-02-26 09:16:03 +0100
commitcf1cffa76e00216477255c62ed5a870e7da345a7 (patch)
treedad6a78b79ec7ba971478bb29170693b71fc8116 /src
parent7993aa20cd20cdc030f90ee9f33c1b74c023d7ca (diff)
downloadlombok-cf1cffa76e00216477255c62ed5a870e7da345a7.tar.gz
lombok-cf1cffa76e00216477255c62ed5a870e7da345a7.tar.bz2
lombok-cf1cffa76e00216477255c62ed5a870e7da345a7.zip
Set missing argumentTypes for eclipse extension methods
Diffstat (limited to 'src')
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java b/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java
index 5d586dff..fcc76059 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java
@@ -24,6 +24,7 @@ package lombok.eclipse.agent;
import static lombok.eclipse.handlers.EclipseHandlerUtil.createAnnotation;
import java.lang.ref.WeakReference;
+import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -39,6 +40,7 @@ import lombok.eclipse.EclipseNode;
import lombok.eclipse.TransformEclipseAST;
import lombok.eclipse.handlers.EclipseHandlerUtil;
import lombok.experimental.ExtensionMethod;
+import lombok.permit.Permit;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
@@ -293,6 +295,13 @@ public class PatchExtensionMethod {
methodCall.actualReceiverType = extensionMethod.declaringClass;
methodCall.binding = fixedBinding;
methodCall.resolvedType = methodCall.binding.returnType;
+ if (Reflection.argumentTypes != null) {
+ try {
+ Reflection.argumentTypes.set(methodCall, argumentTypes.toArray(new TypeBinding[0]));
+ } catch (IllegalAccessException ignore) {
+ // ignore
+ }
+ }
}
return methodCall.resolvedType;
}
@@ -329,4 +338,18 @@ public class PatchExtensionMethod {
return new QualifiedNameReference(sources, poss, source.sourceStart, source.sourceEnd);
}
}
+
+ private static final class Reflection {
+ public static final Field argumentTypes;
+
+ static {
+ Field a = null;
+ try {
+ a = Permit.getField(MessageSend.class, "argumentTypes");
+ } catch (Throwable t) {
+ //ignore - old eclipse versions don't know this one
+ }
+ argumentTypes = a;
+ }
+ }
}