aboutsummaryrefslogtreecommitdiff
path: root/src/utils/lombok/javac/java6
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/lombok/javac/java6')
-rw-r--r--src/utils/lombok/javac/java6/CommentCollectingParser.java8
-rw-r--r--src/utils/lombok/javac/java6/CommentCollectingParserFactory.java8
-rw-r--r--src/utils/lombok/javac/java6/CommentCollectingScanner.java19
3 files changed, 20 insertions, 15 deletions
diff --git a/src/utils/lombok/javac/java6/CommentCollectingParser.java b/src/utils/lombok/javac/java6/CommentCollectingParser.java
index 0915bbb8..94a85e55 100644
--- a/src/utils/lombok/javac/java6/CommentCollectingParser.java
+++ b/src/utils/lombok/javac/java6/CommentCollectingParser.java
@@ -2,7 +2,7 @@ package lombok.javac.java6;
import java.util.Map;
-import lombok.javac.Comment;
+import lombok.javac.CommentInfo;
import com.sun.tools.javac.parser.EndPosParser;
import com.sun.tools.javac.parser.Lexer;
@@ -12,10 +12,10 @@ import com.sun.tools.javac.util.List;
class CommentCollectingParser extends EndPosParser {
- private final Map<JCCompilationUnit, List<Comment>> commentsMap;
+ private final Map<JCCompilationUnit, List<CommentInfo>> commentsMap;
private final Lexer lexer;
- protected CommentCollectingParser(Parser.Factory fac, Lexer S, boolean keepDocComments, Map<JCCompilationUnit, List<Comment>> commentsMap) {
+ protected CommentCollectingParser(Parser.Factory fac, Lexer S, boolean keepDocComments, Map<JCCompilationUnit, List<CommentInfo>> commentsMap) {
super(fac, S, keepDocComments);
lexer = S;
this.commentsMap = commentsMap;
@@ -24,7 +24,7 @@ class CommentCollectingParser extends EndPosParser {
@Override public JCCompilationUnit compilationUnit() {
JCCompilationUnit result = super.compilationUnit();
if (lexer instanceof CommentCollectingScanner) {
- List<Comment> comments = ((CommentCollectingScanner)lexer).getComments();
+ List<CommentInfo> comments = ((CommentCollectingScanner)lexer).getComments();
commentsMap.put(result, comments);
}
return result;
diff --git a/src/utils/lombok/javac/java6/CommentCollectingParserFactory.java b/src/utils/lombok/javac/java6/CommentCollectingParserFactory.java
index 074f956e..b2a248c8 100644
--- a/src/utils/lombok/javac/java6/CommentCollectingParserFactory.java
+++ b/src/utils/lombok/javac/java6/CommentCollectingParserFactory.java
@@ -3,7 +3,7 @@ package lombok.javac.java6;
import java.lang.reflect.Field;
import java.util.Map;
-import lombok.javac.Comment;
+import lombok.javac.CommentInfo;
import com.sun.tools.javac.main.JavaCompiler;
import com.sun.tools.javac.parser.Lexer;
@@ -13,13 +13,13 @@ import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.List;
public class CommentCollectingParserFactory extends Parser.Factory {
- private final Map<JCCompilationUnit, List<Comment>> commentsMap;
+ private final Map<JCCompilationUnit, List<CommentInfo>> commentsMap;
static Context.Key<Parser.Factory> key() {
return parserFactoryKey;
}
- protected CommentCollectingParserFactory(Context context, Map<JCCompilationUnit, List<Comment>> commentsMap) {
+ protected CommentCollectingParserFactory(Context context, Map<JCCompilationUnit, List<CommentInfo>> commentsMap) {
super(context);
this.commentsMap = commentsMap;
}
@@ -32,7 +32,7 @@ public class CommentCollectingParserFactory extends Parser.Factory {
//Either way this will work out.
}
- public static void setInCompiler(JavaCompiler compiler, Context context, Map<JCCompilationUnit, List<Comment>> commentsMap) {
+ public static void setInCompiler(JavaCompiler compiler, Context context, Map<JCCompilationUnit, List<CommentInfo>> commentsMap) {
context.put(CommentCollectingParserFactory.key(), (Parser.Factory)null);
Field field;
try {
diff --git a/src/utils/lombok/javac/java6/CommentCollectingScanner.java b/src/utils/lombok/javac/java6/CommentCollectingScanner.java
index a33b4055..66e1514d 100644
--- a/src/utils/lombok/javac/java6/CommentCollectingScanner.java
+++ b/src/utils/lombok/javac/java6/CommentCollectingScanner.java
@@ -23,9 +23,9 @@ package lombok.javac.java6;
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.parser.Scanner;
import com.sun.tools.javac.util.List;
@@ -33,7 +33,7 @@ import com.sun.tools.javac.util.ListBuffer;
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) {
@@ -54,14 +54,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;
}
@@ -93,7 +98,7 @@ public class CommentCollectingScanner extends Scanner {
return c == '\n' || c == '\r';
}
- public List<Comment> getComments() {
+ public List<CommentInfo> getComments() {
return comments.toList();
}
}