From cb4c8ca4a1392844cd01b573e53b7926c1374872 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 1 Sep 2009 21:09:27 +0200 Subject: Fixed the problem where the eclipse editor AST just loses track of things when using @SneakyThrows (syntax colouring goes away, first character in the file is italic). --- .../eclipse/handlers/HandleSneakyThrows.java | 28 +++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/lombok/eclipse/handlers/HandleSneakyThrows.java b/src/lombok/eclipse/handlers/HandleSneakyThrows.java index 5c39cf86..e01cbcde 100644 --- a/src/lombok/eclipse/handlers/HandleSneakyThrows.java +++ b/src/lombok/eclipse/handlers/HandleSneakyThrows.java @@ -154,19 +154,24 @@ public class HandleSneakyThrows implements EclipseAnnotationHandler> 32), pE = (int)p; + TryStatement tryStatement = new TryStatement(); tryStatement.tryBlock = new Block(0); + tryStatement.tryBlock.sourceStart = pS; + tryStatement.tryBlock.sourceEnd = pE; tryStatement.tryBlock.statements = contents; TypeReference typeReference; if ( exception.exceptionName.indexOf('.') == -1 ) { - typeReference = new SingleTypeReference(exception.exceptionName.toCharArray(), exception.getPos()); + typeReference = new SingleTypeReference(exception.exceptionName.toCharArray(), p); } else { String[] x = exception.exceptionName.split("\\."); char[][] elems = new char[x.length][]; long[] poss = new long[x.length]; - int start = (int)(exception.getPos() >> 32); + int start = pS; for ( int i = 0 ; i < x.length ; i++ ) { elems[i] = x[i].trim().toCharArray(); int end = start + x[i].length(); @@ -176,19 +181,26 @@ public class HandleSneakyThrows implements EclipseAnnotationHandler