aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java8
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java9
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java4
3 files changed, 20 insertions, 1 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
index d039f015..e3cae373 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
@@ -62,6 +62,7 @@ public class EclipsePatcher extends Agent {
patchLombokizeAST(sm);
patchCatchReparse(sm);
patchIdentifierEndReparse(sm);
+ patchRetrieveEllipsisStartPosition(sm);
patchSetGeneratedFlag(sm);
patchHideGeneratedNodes(sm);
patchLiveDebug(sm);
@@ -151,6 +152,13 @@ public class EclipsePatcher extends Agent {
.transplant().request(StackRequest.RETURN_VALUE, StackRequest.PARAM2).build());
}
+ private static void patchRetrieveEllipsisStartPosition(ScriptManager sm) {
+ sm.addScript(ScriptBuilder.wrapReturnValue()
+ .target(new MethodTarget("org.eclipse.jdt.core.dom.ASTConverter", "retrieveEllipsisStartPosition"))
+ .wrapMethod(new Hook("lombok.eclipse.agent.PatchFixes", "fixRetrieveEllipsisStartPosition", "int", "int", "int"))
+ .transplant().request(StackRequest.RETURN_VALUE, StackRequest.PARAM2).build());
+ }
+
private static void patchSetGeneratedFlag(ScriptManager sm) {
sm.addScript(ScriptBuilder.addField()
.targetClass("org.eclipse.jdt.internal.compiler.ast.ASTNode")
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java
index a63617d4..8c1a8db7 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchDelegate.java
@@ -166,7 +166,6 @@ public class PatchDelegate {
if (!Arrays.equals(mb.selector, name)) continue;
int paramLen = mb.parameters == null ? 0 : mb.parameters.length;
if (paramLen != args.length) continue;
- // TODO check if varargs are copied or otherwise handled correctly.
for (int i = 0; i < paramLen; i++) {
if (!mb.parameters[i].erasure().isEquivalentTo(args[i])) continue methods;
}
@@ -328,6 +327,8 @@ public class PatchDelegate {
* }
*/
+ boolean isVarargs = (pair.base.modifiers & ClassFileConstants.AccVarargs) != 0;
+
try {
checkConflictOfTypeVarNames(pair, typeNode);
} catch (CantMakeDelegates e) {
@@ -423,6 +424,12 @@ public class PatchDelegate {
call.arguments[i] = new SingleNameReference(argName, pos(source));
Eclipse.setGeneratedBy(call.arguments[i], source);
}
+ if (isVarargs) {
+ method.arguments[method.arguments.length - 1].type.bits |= ASTNode.IsVarArgs;
+ }
+ for (int i = 0; i < method.arguments.length; i++) {
+ System.out.printf("Positions of marg type: %d %d\n", method.arguments[i].sourceStart(), method.arguments[i].sourceEnd());
+ }
}
Statement body;
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
index 8a07302c..2c002bb6 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
@@ -44,6 +44,10 @@ public class PatchFixes {
return original == -1 ? end : original;
}
+ public static int fixRetrieveEllipsisStartPosition(int original, int end) {
+ return original == -1 ? end : original;
+ }
+
public static final int ALREADY_PROCESSED_FLAG = 0x800000; //Bit 24
public static boolean checkBit24(Object node) throws Exception {