aboutsummaryrefslogtreecommitdiff
path: root/src/utils/lombok/javac/java7/CommentCollectingScanner.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/lombok/javac/java7/CommentCollectingScanner.java')
-rw-r--r--src/utils/lombok/javac/java7/CommentCollectingScanner.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/utils/lombok/javac/java7/CommentCollectingScanner.java b/src/utils/lombok/javac/java7/CommentCollectingScanner.java
index b13973b1..e2d040f2 100644
--- a/src/utils/lombok/javac/java7/CommentCollectingScanner.java
+++ b/src/utils/lombok/javac/java7/CommentCollectingScanner.java
@@ -23,16 +23,16 @@ package lombok.javac.java7;
import java.nio.CharBuffer;
-import lombok.javac.Comment;
-import lombok.javac.Comment.EndConnection;
-import lombok.javac.Comment.StartConnection;
+import lombok.javac.CommentInfo;
+import lombok.javac.CommentInfo.EndConnection;
+import lombok.javac.CommentInfo.StartConnection;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.parser.Scanner;
public class CommentCollectingScanner extends Scanner {
- private final ListBuffer<Comment> comments = ListBuffer.lb();
+ private final ListBuffer<CommentInfo> comments = ListBuffer.lb();
private int endComment = 0;
public CommentCollectingScanner(CommentCollectingScannerFactory factory, CharBuffer charBuffer) {
@@ -53,14 +53,19 @@ public class CommentCollectingScanner extends Scanner {
StartConnection start = determineStartConnection(prevEndPos, pos);
EndConnection end = determineEndConnection(endPos);
- Comment comment = new Comment(prevEndPos, pos, endPos, content, start, end);
+ CommentInfo comment = new CommentInfo(prevEndPos, pos, endPos, content, start, end);
comments.append(comment);
}
private EndConnection determineEndConnection(int pos) {
boolean first = true;
for (int i = pos;; i++) {
- char c = getRawCharacters(i, i + 1)[0];
+ char c;
+ try {
+ c = getRawCharacters(i, i + 1)[0];
+ } catch (IndexOutOfBoundsException e) {
+ c = '\n';
+ }
if (isNewLine(c)) {
return EndConnection.ON_NEXT_LINE;
}
@@ -92,7 +97,7 @@ public class CommentCollectingScanner extends Scanner {
return c == '\n' || c == '\r';
}
- public List<Comment> getComments() {
+ public List<CommentInfo> getComments() {
return comments.toList();
}
}