aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2011-11-15 14:22:46 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2011-11-15 14:22:46 +0100
commitdc92425f85d2f2dd187b688ff6d218d3c8e657b6 (patch)
treee654c0016c01c34da8f5635625d04225e3c58cbd /src
parent1cdd42ac10c128765d3ff642d808c00eab6a1782 (diff)
parent5cc928f471f3875f141ab1ee737cfe2613e9cdd6 (diff)
downloadlombok-dc92425f85d2f2dd187b688ff6d218d3c8e657b6.tar.gz
lombok-dc92425f85d2f2dd187b688ff6d218d3c8e657b6.tar.bz2
lombok-dc92425f85d2f2dd187b688ff6d218d3c8e657b6.zip
Merge branch 'Issue_263' of https://github.com/jvanderhel/lombok into jvanderhel-Issue_263
Conflicts: src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
Diffstat (limited to 'src')
-rw-r--r--src/core/lombok/eclipse/handlers/HandleConstructor.java1
-rw-r--r--src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java2
-rw-r--r--src/core/lombok/eclipse/handlers/HandleSetter.java2
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java9
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java4
5 files changed, 16 insertions, 2 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleConstructor.java b/src/core/lombok/eclipse/handlers/HandleConstructor.java
index 63b04f4c..5b7cdcaa 100644
--- a/src/core/lombok/eclipse/handlers/HandleConstructor.java
+++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java
@@ -249,6 +249,7 @@ public class HandleConstructor {
SingleNameReference assignmentNameRef = new SingleNameReference(field.name, p);
setGeneratedBy(assignmentNameRef, source);
Assignment assignment = new Assignment(thisX, assignmentNameRef, (int)p);
+ assignment.sourceStart = (int)(p >> 32); assignment.sourceEnd = assignment.statementEnd = (int)(p >> 32);
setGeneratedBy(assignment, source);
assigns.add(assignment);
long fieldPos = (((long)field.sourceStart) << 32) | field.sourceEnd;
diff --git a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
index 83e78289..3c41f834 100644
--- a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
+++ b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
@@ -391,7 +391,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndH
resultRef = new SingleNameReference(RESULT, p);
setGeneratedBy(resultRef, source);
Assignment assignment = new Assignment(resultRef, addItem, pE);
- assignment.sourceStart = pS; assignment.sourceEnd = pE;
+ assignment.sourceStart = pS; assignment.sourceEnd = assignment.statementEnd = pE;
setGeneratedBy(assignment, source);
statements.add(assignment);
}
diff --git a/src/core/lombok/eclipse/handlers/HandleSetter.java b/src/core/lombok/eclipse/handlers/HandleSetter.java
index a32d45fc..ea81965b 100644
--- a/src/core/lombok/eclipse/handlers/HandleSetter.java
+++ b/src/core/lombok/eclipse/handlers/HandleSetter.java
@@ -198,7 +198,7 @@ public class HandleSetter extends EclipseAnnotationHandler<Setter> {
NameReference fieldNameRef = new SingleNameReference(field.name, p);
setGeneratedBy(fieldNameRef, source);
Assignment assignment = new Assignment(fieldRef, fieldNameRef, (int)p);
- assignment.sourceStart = pS; assignment.sourceEnd = pE;
+ assignment.sourceStart = pS; assignment.sourceEnd = assignment.statementEnd = pE;
setGeneratedBy(assignment, source);
method.bodyStart = method.declarationSourceStart = method.sourceStart = source.sourceStart;
method.bodyEnd = method.declarationSourceEnd = method.sourceEnd = source.sourceEnd;
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
index 6043fdef..0ad7102b 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);
@@ -222,6 +223,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")
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
index f5306ab9..69024afa 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
@@ -64,6 +64,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