aboutsummaryrefslogtreecommitdiff
path: root/src/utils/lombok/javac/java6/CommentCollectingScanner.java
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2011-10-31 23:19:25 +0100
committerRoel Spilker <r.spilker@gmail.com>2011-10-31 23:19:25 +0100
commit70f778daa560a899abe91a4908cd37c70ff1f3b4 (patch)
treefbf77f10ebffc9da1ab59be25c4ff6499f9dc54a /src/utils/lombok/javac/java6/CommentCollectingScanner.java
parented177bb7822f460bf7e3b07a1f5754f127842a63 (diff)
downloadlombok-70f778daa560a899abe91a4908cd37c70ff1f3b4.tar.gz
lombok-70f778daa560a899abe91a4908cd37c70ff1f3b4.tar.bz2
lombok-70f778daa560a899abe91a4908cd37c70ff1f3b4.zip
Fixed delombok making a mess of comments (issue 284) for javac 6. delombok in java7 is now completely broken but we'll fix that next.
Diffstat (limited to 'src/utils/lombok/javac/java6/CommentCollectingScanner.java')
-rw-r--r--src/utils/lombok/javac/java6/CommentCollectingScanner.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/utils/lombok/javac/java6/CommentCollectingScanner.java b/src/utils/lombok/javac/java6/CommentCollectingScanner.java
index 363e04ba..8fa0a766 100644
--- a/src/utils/lombok/javac/java6/CommentCollectingScanner.java
+++ b/src/utils/lombok/javac/java6/CommentCollectingScanner.java
@@ -24,24 +24,24 @@ package lombok.javac.java6;
import java.nio.CharBuffer;
import lombok.javac.Comment;
-import lombok.javac.Comments;
import lombok.javac.Comment.EndConnection;
import lombok.javac.Comment.StartConnection;
import com.sun.tools.javac.parser.Scanner;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.ListBuffer;
+
public class CommentCollectingScanner extends Scanner {
- private final Comments comments;
+ private final ListBuffer<Comment> comments = ListBuffer.lb();
private int endComment = 0;
- public CommentCollectingScanner(CommentCollectingScannerFactory factory, CharBuffer charBuffer, Comments comments) {
+ public CommentCollectingScanner(CommentCollectingScannerFactory factory, CharBuffer charBuffer) {
super(factory, charBuffer);
- this.comments = comments;
}
- public CommentCollectingScanner(CommentCollectingScannerFactory factory, char[] input, int inputLength, Comments comments) {
+ public CommentCollectingScanner(CommentCollectingScannerFactory factory, char[] input, int inputLength) {
super(factory, input, inputLength);
- this.comments = comments;
}
@Override
@@ -55,7 +55,7 @@ public class CommentCollectingScanner extends Scanner {
EndConnection end = determineEndConnection(endPos);
Comment comment = new Comment(prevEndPos, pos, endPos, content, start, end);
- comments.add(comment);
+ comments.append(comment);
}
private EndConnection determineEndConnection(int pos) {
@@ -92,4 +92,8 @@ public class CommentCollectingScanner extends Scanner {
private boolean isNewLine(char c) {
return c == '\n' || c == '\r';
}
+
+ public List<Comment> getComments() {
+ return comments.toList();
+ }
}