aboutsummaryrefslogtreecommitdiff
path: root/src/utils/lombok/javac/java6
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2014-06-06 02:56:05 +0200
committerRoel Spilker <r.spilker@gmail.com>2014-06-06 02:56:05 +0200
commit33ead46639087a4e772d6535d0354f39fadc5724 (patch)
tree1a7806ed96d22727e7eda70fcd4231df55668f5e /src/utils/lombok/javac/java6
parent288a2236c0d5c4c129d837330ca16bfef8e5b2e2 (diff)
parent68c5b016f9a2663abc9cd4aeb0cc0034949469ca (diff)
downloadlombok-33ead46639087a4e772d6535d0354f39fadc5724.tar.gz
lombok-33ead46639087a4e772d6535d0354f39fadc5724.tar.bz2
lombok-33ead46639087a4e772d6535d0354f39fadc5724.zip
Merge branch 'master' into configResolutionInEclipse
Diffstat (limited to 'src/utils/lombok/javac/java6')
-rw-r--r--src/utils/lombok/javac/java6/CommentCollectingParser.java9
-rw-r--r--src/utils/lombok/javac/java6/CommentCollectingParserFactory.java16
2 files changed, 7 insertions, 18 deletions
diff --git a/src/utils/lombok/javac/java6/CommentCollectingParser.java b/src/utils/lombok/javac/java6/CommentCollectingParser.java
index 215bf5b6..d5d3c256 100644
--- a/src/utils/lombok/javac/java6/CommentCollectingParser.java
+++ b/src/utils/lombok/javac/java6/CommentCollectingParser.java
@@ -21,7 +21,7 @@
*/
package lombok.javac.java6;
-import lombok.core.ReferenceFieldAugment;
+import static lombok.javac.CommentCatcher.JCCompilationUnit_comments;
import lombok.javac.CommentInfo;
import com.sun.tools.javac.parser.EndPosParser;
@@ -31,21 +31,18 @@ import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
import com.sun.tools.javac.util.List;
class CommentCollectingParser extends EndPosParser {
-
- private final ReferenceFieldAugment<JCCompilationUnit, List<CommentInfo>> commentsField;
private final Lexer lexer;
- protected CommentCollectingParser(Parser.Factory fac, Lexer S, boolean keepDocComments, ReferenceFieldAugment<JCCompilationUnit, List<CommentInfo>> commentsField) {
+ protected CommentCollectingParser(Parser.Factory fac, Lexer S, boolean keepDocComments) {
super(fac, S, keepDocComments);
lexer = S;
- this.commentsField = commentsField;
}
@Override public JCCompilationUnit compilationUnit() {
JCCompilationUnit result = super.compilationUnit();
if (lexer instanceof CommentCollectingScanner) {
List<CommentInfo> comments = ((CommentCollectingScanner)lexer).getComments();
- commentsField.set(result, comments);
+ JCCompilationUnit_comments.set(result, comments);
}
return result;
}
diff --git a/src/utils/lombok/javac/java6/CommentCollectingParserFactory.java b/src/utils/lombok/javac/java6/CommentCollectingParserFactory.java
index 124a05f7..0cf8fdcd 100644
--- a/src/utils/lombok/javac/java6/CommentCollectingParserFactory.java
+++ b/src/utils/lombok/javac/java6/CommentCollectingParserFactory.java
@@ -23,43 +23,35 @@ package lombok.javac.java6;
import java.lang.reflect.Field;
-import lombok.core.ReferenceFieldAugment;
-import lombok.javac.CommentInfo;
-
import com.sun.tools.javac.main.JavaCompiler;
import com.sun.tools.javac.parser.Lexer;
import com.sun.tools.javac.parser.Parser;
-import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.List;
public class CommentCollectingParserFactory extends Parser.Factory {
- private final ReferenceFieldAugment<JCCompilationUnit, List<CommentInfo>> commentsField;
-
static Context.Key<Parser.Factory> key() {
return parserFactoryKey;
}
- protected CommentCollectingParserFactory(Context context, ReferenceFieldAugment<JCCompilationUnit, List<CommentInfo>> commentsField) {
+ protected CommentCollectingParserFactory(Context context) {
super(context);
- this.commentsField = commentsField;
}
@Override public Parser newParser(Lexer S, boolean keepDocComments, boolean genEndPos) {
- Object x = new CommentCollectingParser(this, S, true, commentsField);
+ Object x = new CommentCollectingParser(this, S, true);
return (Parser) x;
// CCP is based on a stub which extends nothing, but at runtime the stub is replaced with either
//javac6's EndPosParser which extends Parser, or javac7's EndPosParser which implements Parser.
//Either way this will work out.
}
- public static void setInCompiler(JavaCompiler compiler, Context context, ReferenceFieldAugment<JCCompilationUnit, List<CommentInfo>> commentsField) {
+ public static void setInCompiler(JavaCompiler compiler, Context context) {
context.put(CommentCollectingParserFactory.key(), (Parser.Factory)null);
Field field;
try {
field = JavaCompiler.class.getDeclaredField("parserFactory");
field.setAccessible(true);
- field.set(compiler, new CommentCollectingParserFactory(context, commentsField));
+ field.set(compiler, new CommentCollectingParserFactory(context));
} catch (Exception e) {
throw new IllegalStateException("Could not set comment sensitive parser in the compiler", e);
}