diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-09-03 00:11:00 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-09-03 00:12:09 +0200 |
commit | 2b51cf84f4b11fb458c566317b4c2ecc94c8631b (patch) | |
tree | 9e72cbb8222e07ffb1101b73ad82f6f4311b7b91 /src/lombok | |
parent | 3bffd6b08e75e5f8737749b911359317920cdb37 (diff) | |
download | lombok-2b51cf84f4b11fb458c566317b4c2ecc94c8631b.tar.gz lombok-2b51cf84f4b11fb458c566317b4c2ecc94c8631b.tar.bz2 lombok-2b51cf84f4b11fb458c566317b4c2ecc94c8631b.zip |
I think this one FINALLY fixes the problems with SneakyThrows! Issue #30
Diffstat (limited to 'src/lombok')
-rw-r--r-- | src/lombok/eclipse/handlers/HandleSneakyThrows.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lombok/eclipse/handlers/HandleSneakyThrows.java b/src/lombok/eclipse/handlers/HandleSneakyThrows.java index e01cbcde..f0ff53db 100644 --- a/src/lombok/eclipse/handlers/HandleSneakyThrows.java +++ b/src/lombok/eclipse/handlers/HandleSneakyThrows.java @@ -21,6 +21,7 @@ */ package lombok.eclipse.handlers; +import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.List; @@ -167,6 +168,7 @@ public class HandleSneakyThrows implements EclipseAnnotationHandler<SneakyThrows TypeReference typeReference; if ( exception.exceptionName.indexOf('.') == -1 ) { typeReference = new SingleTypeReference(exception.exceptionName.toCharArray(), p); + typeReference.statementEnd = pE; } else { String[] x = exception.exceptionName.split("\\."); char[][] elems = new char[x.length][]; @@ -181,7 +183,7 @@ public class HandleSneakyThrows implements EclipseAnnotationHandler<SneakyThrows typeReference = new QualifiedTypeReference(elems, poss); } - Argument catchArg = new Argument("$ex".toCharArray(), p, typeReference, 0); + Argument catchArg = new Argument("$ex".toCharArray(), p, typeReference, Modifier.FINAL); catchArg.declarationSourceEnd = catchArg.declarationEnd = catchArg.sourceEnd = pE; catchArg.declarationSourceStart = catchArg.modifiersSourceStart = catchArg.sourceStart = pS; @@ -189,8 +191,12 @@ public class HandleSneakyThrows implements EclipseAnnotationHandler<SneakyThrows MessageSend sneakyThrowStatement = new MessageSend(); sneakyThrowStatement.receiver = new QualifiedNameReference(new char[][] { "lombok".toCharArray(), "Lombok".toCharArray() }, new long[] { p, p }, pS, pE); + sneakyThrowStatement.receiver.statementEnd = pE; sneakyThrowStatement.selector = "sneakyThrow".toCharArray(); - sneakyThrowStatement.arguments = new Expression[] { new SingleNameReference("$ex".toCharArray(), p) }; + SingleNameReference exRef = new SingleNameReference("$ex".toCharArray(), p); + exRef.statementEnd = pE; + sneakyThrowStatement.arguments = new Expression[] { exRef }; + sneakyThrowStatement.nameSourcePosition = p; sneakyThrowStatement.sourceStart = pS; sneakyThrowStatement.sourceEnd = sneakyThrowStatement.statementEnd = pE; Statement rethrowStatement = new ThrowStatement(sneakyThrowStatement, pS, pE); |