diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-09-01 19:17:09 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-09-01 19:17:09 +0200 |
commit | da367086c56b1a21a549a81d66d6f85ae04709fd (patch) | |
tree | 9a13a9a763dce81fafc2fc433c640737c3ba144f /src/lombok/eclipse/handlers | |
parent | 25e33d02e3b91b04947257ffa3c6233f1c81d3ce (diff) | |
download | lombok-da367086c56b1a21a549a81d66d6f85ae04709fd.tar.gz lombok-da367086c56b1a21a549a81d66d6f85ae04709fd.tar.bz2 lombok-da367086c56b1a21a549a81d66d6f85ae04709fd.zip |
More work on fully addressing the David Lynch bug (issue #41) - the annotation @NotNull/@NonNull/@Nullable that is copied over by @Getter should no longer be causing the David Lynch bug.
Diffstat (limited to 'src/lombok/eclipse/handlers')
-rw-r--r-- | src/lombok/eclipse/handlers/HandleData.java | 4 | ||||
-rw-r--r-- | src/lombok/eclipse/handlers/HandleGetter.java | 6 | ||||
-rw-r--r-- | src/lombok/eclipse/handlers/HandleSetter.java | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/src/lombok/eclipse/handlers/HandleData.java b/src/lombok/eclipse/handlers/HandleData.java index a6af683a..385f56d4 100644 --- a/src/lombok/eclipse/handlers/HandleData.java +++ b/src/lombok/eclipse/handlers/HandleData.java @@ -158,7 +158,7 @@ public class HandleData implements EclipseAnnotationHandler<Data> { Statement nullCheck = generateNullCheck(field); if (nullCheck != null) nullChecks.add(nullCheck); } - Annotation[] copiedAnnotations = copyAnnotations(nonNulls, nullables); + Annotation[] copiedAnnotations = copyAnnotations(nonNulls, nullables, p); if (copiedAnnotations.length != 0) argument.annotations = copiedAnnotations; args.add(argument); } @@ -205,7 +205,7 @@ public class HandleData implements EclipseAnnotationHandler<Data> { Argument argument = new Argument(field.name, fieldPos, copyType(field.type), 0); Annotation[] copiedAnnotations = copyAnnotations( - findAnnotations(field, TransformationsUtil.NON_NULL_PATTERN), findAnnotations(field, TransformationsUtil.NULLABLE_PATTERN)); + findAnnotations(field, TransformationsUtil.NON_NULL_PATTERN), findAnnotations(field, TransformationsUtil.NULLABLE_PATTERN), p); if (copiedAnnotations.length != 0) argument.annotations = copiedAnnotations; args.add(new Argument(field.name, fieldPos, copyType(field.type), Modifier.FINAL)); } diff --git a/src/lombok/eclipse/handlers/HandleGetter.java b/src/lombok/eclipse/handlers/HandleGetter.java index c3abd9f3..2ba3876a 100644 --- a/src/lombok/eclipse/handlers/HandleGetter.java +++ b/src/lombok/eclipse/handlers/HandleGetter.java @@ -81,6 +81,8 @@ public class HandleGetter implements EclipseAnnotationHandler<Getter> { } private boolean createGetterForField(AccessLevel level, Node fieldNode, Node errorNode, ASTNode pos, boolean whineIfExists) { + int pS = pos.sourceStart(), pE = pos.sourceEnd(); + long p = (long)pS << 32 | pE; if ( fieldNode.getKind() != Kind.FIELD ) { errorNode.addError("@Getter is only supported on a field."); return true; @@ -103,7 +105,7 @@ public class HandleGetter implements EclipseAnnotationHandler<Getter> { String altNameExpl = ""; if ( !altName.equals(getterName) ) altNameExpl = String.format(" (%s)", altName); errorNode.addWarning( - String.format("Not generating %s(): A method with that name already exists%s", getterName, altNameExpl)); + String.format("Not generating %s(): A method with that name already exists%s", getterName, altNameExpl)); } return true; default: @@ -114,7 +116,7 @@ public class HandleGetter implements EclipseAnnotationHandler<Getter> { MethodDeclaration method = generateGetter((TypeDeclaration) fieldNode.up().get(), field, getterName, modifier, pos); Annotation[] copiedAnnotations = copyAnnotations( - findAnnotations(field, TransformationsUtil.NON_NULL_PATTERN), findAnnotations(field, TransformationsUtil.NULLABLE_PATTERN)); + findAnnotations(field, TransformationsUtil.NON_NULL_PATTERN), findAnnotations(field, TransformationsUtil.NULLABLE_PATTERN), p); if (copiedAnnotations.length != 0) { method.annotations = copiedAnnotations; } diff --git a/src/lombok/eclipse/handlers/HandleSetter.java b/src/lombok/eclipse/handlers/HandleSetter.java index 17747d8c..8c47a43b 100644 --- a/src/lombok/eclipse/handlers/HandleSetter.java +++ b/src/lombok/eclipse/handlers/HandleSetter.java @@ -151,7 +151,7 @@ public class HandleSetter implements EclipseAnnotationHandler<Setter> { if (nullCheck != null) method.statements = new Statement[] { nullCheck, assignment }; else method.statements = new Statement[] { assignment }; } - Annotation[] copiedAnnotations = copyAnnotations(nonNulls, nullables); + Annotation[] copiedAnnotations = copyAnnotations(nonNulls, nullables, pos); if (copiedAnnotations.length != 0) param.annotations = copiedAnnotations; return method; } |