aboutsummaryrefslogtreecommitdiff
path: root/src/eclipseAgent/lombok/eclipse/agent
diff options
context:
space:
mode:
authorjvanderhel <Jappe.vanderhel@gmail.com>2011-11-12 19:13:28 +0100
committerjvanderhel <Jappe.vanderhel@gmail.com>2011-11-12 19:13:28 +0100
commit5cc928f471f3875f141ab1ee737cfe2613e9cdd6 (patch)
tree03231098ddc1350d7896610f044a34edc674fa94 /src/eclipseAgent/lombok/eclipse/agent
parent9433db4ecdf1a525541581a73161ababee0c352c (diff)
downloadlombok-5cc928f471f3875f141ab1ee737cfe2613e9cdd6.tar.gz
lombok-5cc928f471f3875f141ab1ee737cfe2613e9cdd6.tar.bz2
lombok-5cc928f471f3875f141ab1ee737cfe2613e9cdd6.zip
patched retrieveRightBraceOrSemiColonPosition && retrieveRightBrace so method bodies are converted instead of skipped
Set Assignment.statementEnd to prevent invalid sourceRange in Statement convert
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse/agent')
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java13
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java4
2 files changed, 15 insertions, 2 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
index b52a3b23..a502d831 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
@@ -84,6 +84,7 @@ public class EclipsePatcher extends Agent {
patchCatchReparse(sm);
patchIdentifierEndReparse(sm);
patchRetrieveEllipsisStartPosition(sm);
+ patchRetrieveRightBraceOrSemiColonPosition(sm);
patchSetGeneratedFlag(sm);
patchDomAstReparseIssues(sm);
patchHideGeneratedNodes(sm);
@@ -98,7 +99,7 @@ public class EclipsePatcher extends Agent {
if (reloadExistingClasses) sm.reloadClasses(instrumentation);
}
-
+
private static void patchDomAstReparseIssues(ScriptManager sm) {
sm.addScript(ScriptBuilder.replaceMethodCall()
.target(new MethodTarget("org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer", "visit"))
@@ -193,6 +194,14 @@ public class EclipsePatcher extends Agent {
.transplant().request(StackRequest.RETURN_VALUE, StackRequest.PARAM2).build());
}
+ private static void patchRetrieveRightBraceOrSemiColonPosition(ScriptManager sm) {
+ sm.addScript(ScriptBuilder.wrapReturnValue()
+ .target(new MethodTarget("org.eclipse.jdt.core.dom.ASTConverter", "retrieveRightBraceOrSemiColonPosition"))
+ .target(new MethodTarget("org.eclipse.jdt.core.dom.ASTConverter", "retrieveRightBrace"))
+ .wrapMethod(new Hook("lombok.eclipse.agent.PatchFixes", "fixRetrieveRightBraceOrSemiColonPosition", "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")
@@ -399,4 +408,4 @@ public class EclipsePatcher extends Agent {
.wrapMethod(new Hook("lombok.eclipse.agent.PatchFixes", "convertAnnotations", ANNOTATION_SIG + "[]", ANNOTATION_SIG + "[]", I_ANNOTATABLE_SIG))
.request(StackRequest.PARAM1, StackRequest.RETURN_VALUE).build());
}
-}
+} \ No newline at end of file
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
index 6d5fdaec..89fd78d3 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
@@ -52,6 +52,10 @@ public class PatchFixes {
public static int fixRetrieveEllipsisStartPosition(int original, int end) {
return original == -1 ? end : original;
}
+
+ public static int fixRetrieveRightBraceOrSemiColonPosition(int original, int end) {
+ return original == -1 ? end : original;
+ }
public static final int ALREADY_PROCESSED_FLAG = 0x800000; //Bit 24