aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJappe van der Hel <jappe.vanderhel@gmail.com>2012-01-18 11:53:17 +0100
committerJappe van der Hel <jappe.vanderhel@gmail.com>2012-01-18 11:53:17 +0100
commit5185f97cd6dd7697eeca2455897cbad9dea9ed96 (patch)
treeed97af20ab98a2257dcad759fb1212a6cda89ad6
parent68fe3f41e962d247ec372e40c8714f57e5ebee05 (diff)
downloadlombok-5185f97cd6dd7697eeca2455897cbad9dea9ed96.tar.gz
lombok-5185f97cd6dd7697eeca2455897cbad9dea9ed96.tar.bz2
lombok-5185f97cd6dd7697eeca2455897cbad9dea9ed96.zip
1) rollback of rollback fixRetrieveRightBraceOrSemiColonPosition
2) HandleEqualsAndHashCode now use SetGeneratedByVisitor to ensure "correct" sourcepositions 3) SetGeneratedByVisitor now sets QualifiedNameReference.sourcePositions
-rw-r--r--src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java3
-rw-r--r--src/core/lombok/eclipse/handlers/SetGeneratedByVisitor.java11
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java4
3 files changed, 14 insertions, 4 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
index d4c63da3..ef01835c 100644
--- a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
+++ b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
@@ -222,14 +222,17 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndH
}
MethodDeclaration equalsMethod = createEquals(typeNode, nodesForEquality, callSuper, errorNode.get(), fieldAccess, needsCanEqual);
+ equalsMethod.traverse(new SetGeneratedByVisitor(errorNode.get()), ((TypeDeclaration)typeNode.get()).scope);
injectMethod(typeNode, equalsMethod);
if (needsCanEqual) {
MethodDeclaration canEqualMethod = createCanEqual(typeNode, errorNode.get());
+ canEqualMethod.traverse(new SetGeneratedByVisitor(errorNode.get()), ((TypeDeclaration)typeNode.get()).scope);
injectMethod(typeNode, canEqualMethod);
}
MethodDeclaration hashCodeMethod = createHashCode(typeNode, nodesForEquality, callSuper, errorNode.get(), fieldAccess);
+ hashCodeMethod.traverse(new SetGeneratedByVisitor(errorNode.get()), ((TypeDeclaration)typeNode.get()).scope);
injectMethod(typeNode, hashCodeMethod);
}
diff --git a/src/core/lombok/eclipse/handlers/SetGeneratedByVisitor.java b/src/core/lombok/eclipse/handlers/SetGeneratedByVisitor.java
index 13292cdd..7d2b7a74 100644
--- a/src/core/lombok/eclipse/handlers/SetGeneratedByVisitor.java
+++ b/src/core/lombok/eclipse/handlers/SetGeneratedByVisitor.java
@@ -247,6 +247,13 @@ public final class SetGeneratedByVisitor extends ASTVisitor {
node.nameSourcePosition = recalcSourcePosition(node.nameSourcePosition);
}
+ private void applyOffsetQualifiedNameReference(QualifiedNameReference node) {
+ applyOffsetExpression(node);
+ for (int i = 0; i < node.sourcePositions.length; i++) {
+ node.sourcePositions[i] = recalcSourcePosition(node.sourcePositions[i]);
+ }
+ }
+
private void applyOffsetQualifiedTypeReference(QualifiedTypeReference node) {
applyOffsetExpression(node);
for (int i = 0; i < node.sourcePositions.length; i++) {
@@ -787,8 +794,8 @@ public final class SetGeneratedByVisitor extends ASTVisitor {
}
@Override public boolean visit(QualifiedNameReference node, BlockScope scope) {
- setGeneratedBy(node, source);
- applyOffsetExpression(node);
+ setGeneratedBy(node, source);
+ applyOffsetQualifiedNameReference(node);
return super.visit(node, scope);
}
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
index 86f2b9cf..5a6b8479 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
@@ -237,8 +237,8 @@ public class PatchFixes {
}
public static int fixRetrieveRightBraceOrSemiColonPosition(int original, int end) {
- return original;
- // return original == -1 ? end : original; // Need to fix: see issue 325.
+// return original;
+ return original == -1 ? end : original; // Need to fix: see issue 325.
}
public static final int ALREADY_PROCESSED_FLAG = 0x800000; //Bit 24