aboutsummaryrefslogtreecommitdiff
path: root/src/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-09-01 18:47:01 +0200
committerReinier Zwitserloot <reinier@tipit.to>2009-09-01 18:47:01 +0200
commit5b160554176f7439fba10fe709b948b8310a4fb0 (patch)
tree32f56f00abf9fdedc65daf845596c457ed120f31 /src/lombok
parent60a62bced8894a90b22725482fb33a9eed967554 (diff)
downloadlombok-5b160554176f7439fba10fe709b948b8310a4fb0.tar.gz
lombok-5b160554176f7439fba10fe709b948b8310a4fb0.tar.bz2
lombok-5b160554176f7439fba10fe709b948b8310a4fb0.zip
Well, bugger me! Adjusting the positions of the actual type identifier for the generated annotations seems to fix the David Lynch bug (issue #41).
Saving this now before further fiddling breaks things again.
Diffstat (limited to 'src/lombok')
-rw-r--r--src/lombok/eclipse/handlers/HandleToString.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lombok/eclipse/handlers/HandleToString.java b/src/lombok/eclipse/handlers/HandleToString.java
index 4b5204b5..86f4496d 100644
--- a/src/lombok/eclipse/handlers/HandleToString.java
+++ b/src/lombok/eclipse/handlers/HandleToString.java
@@ -159,7 +159,8 @@ public class HandleToString implements EclipseAnnotationHandler<ToString> {
}
private MethodDeclaration createToString(Node type, Collection<Node> fields, boolean includeFieldNames, boolean callSuper, ASTNode pos) {
- char[] rawTypeName = ((TypeDeclaration)type.get()).name;
+ TypeDeclaration typeDeclaration = (TypeDeclaration)type.get();
+ char[] rawTypeName = typeDeclaration.name;
String typeName = rawTypeName == null ? "" : new String(rawTypeName);
char[] suffix = ")".toCharArray();
String infixS = ", ";
@@ -227,9 +228,10 @@ public class HandleToString implements EclipseAnnotationHandler<ToString> {
MethodDeclaration method = new MethodDeclaration(((CompilationUnitDeclaration) type.top().get()).compilationResult);
method.modifiers = PKG.toModifier(AccessLevel.PUBLIC);
method.returnType = new QualifiedTypeReference(TypeConstants.JAVA_LANG_STRING, new long[] {0, 0, 0});
- method.annotations = new Annotation[] {
- new MarkerAnnotation(new QualifiedTypeReference(TypeConstants.JAVA_LANG_OVERRIDE, new long[] { 0, 0, 0}), 0)
- };
+ MarkerAnnotation overrideAnnotation = new MarkerAnnotation(new QualifiedTypeReference(TypeConstants.JAVA_LANG_OVERRIDE, new long[] {p, p, p}), (int)(p >> 32));
+ overrideAnnotation.declarationSourceEnd = overrideAnnotation.sourceEnd = overrideAnnotation.statementEnd = (int)p;
+ overrideAnnotation.bits |= ASTNode.HasBeenGenerated;
+ method.annotations = new Annotation[] {overrideAnnotation};
method.arguments = null;
method.selector = "toString".toCharArray();
method.thrownExceptions = null;