mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 18:18:48 +00:00
I think this one FINALLY fixes the problems with SneakyThrows! Issue #30
This commit is contained in:
1 parent
3bffd6b08e
commit
2b51cf84f4
2 files changed
+13
-2
No files matched your search
@@ -1,6 +1,11 @@
|
||||
Lombok Changelog
|
||||
----------------
|
||||
|
||||
### v0.8.5
|
||||
|
||||
* Fixed yet another issue with `@SneakyThrows`. This was reported fixed in v0.8.4. but it still didn't work quite as it should. Still falls under the bailiwick of
|
||||
[Issue #30](http://code.google.com/p/projectlombok/issues/detail?id=30)
|
||||
|
||||
### v0.8.4
|
||||
|
||||
* Fixed many issues with `@SneakyThrows` - in previous versions, using it would sometimes confuse the syntax colouring, and various constructs in the annotated method would cause outright eclipse errors, such as beginning the method with a try block. This also fixes [Issue #30](http://code.google.com/p/projectlombok/issues/detail?id=30)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user