aboutsummaryrefslogtreecommitdiff
path: root/src/utils/lombok/javac/java7/CommentCollectingParserFactory.java
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2014-03-18 21:53:20 +0100
committerRoel Spilker <r.spilker@gmail.com>2014-03-18 21:53:20 +0100
commitdb71f39c271f1f8124fac96daa68d8b012fbf390 (patch)
tree6ac442401e3c3e957caf05decb5baa0602f9043d /src/utils/lombok/javac/java7/CommentCollectingParserFactory.java
parent0de56b76e6e9ba738232a3eb6c66c16df7346c82 (diff)
parent17972d59fa7e2eec6b73ba5da8234f5fa7ac2536 (diff)
downloadlombok-db71f39c271f1f8124fac96daa68d8b012fbf390.tar.gz
lombok-db71f39c271f1f8124fac96daa68d8b012fbf390.tar.bz2
lombok-db71f39c271f1f8124fac96daa68d8b012fbf390.zip
Merge branch 'master' into configuration
Conflicts: build.xml src/core/lombok/eclipse/HandlerLibrary.java src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java src/core/lombok/javac/HandlerLibrary.java src/core/lombok/javac/handlers/JavacHandlerUtil.java
Diffstat (limited to 'src/utils/lombok/javac/java7/CommentCollectingParserFactory.java')
-rw-r--r--src/utils/lombok/javac/java7/CommentCollectingParserFactory.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/utils/lombok/javac/java7/CommentCollectingParserFactory.java b/src/utils/lombok/javac/java7/CommentCollectingParserFactory.java
index ed8279df..dba5a0fa 100644
--- a/src/utils/lombok/javac/java7/CommentCollectingParserFactory.java
+++ b/src/utils/lombok/javac/java7/CommentCollectingParserFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 The Project Lombok Authors.
+ * Copyright (C) 2013-2014 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -23,8 +23,8 @@ package lombok.javac.java7;
import java.lang.reflect.Field;
import java.util.List;
-import java.util.Map;
+import lombok.core.ReferenceFieldAugment;
import lombok.javac.CommentInfo;
import com.sun.tools.javac.main.JavaCompiler;
@@ -36,36 +36,36 @@ import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
import com.sun.tools.javac.util.Context;
public class CommentCollectingParserFactory extends ParserFactory {
- private final Map<JCCompilationUnit, List<CommentInfo>> commentsMap;
+ private final ReferenceFieldAugment<JCCompilationUnit, List<CommentInfo>> commentsField;
private final Context context;
static Context.Key<ParserFactory> key() {
return parserFactoryKey;
}
- protected CommentCollectingParserFactory(Context context, Map<JCCompilationUnit, List<CommentInfo>> commentsMap) {
+ protected CommentCollectingParserFactory(Context context, ReferenceFieldAugment<JCCompilationUnit, List<CommentInfo>> commentsField) {
super(context);
this.context = context;
- this.commentsMap = commentsMap;
+ this.commentsField = commentsField;
}
public Parser newParser(CharSequence input, boolean keepDocComments, boolean keepEndPos, boolean keepLineMap) {
ScannerFactory scannerFactory = ScannerFactory.instance(context);
Lexer lexer = scannerFactory.newScanner(input, true);
- Object x = new CommentCollectingParser(this, lexer, true, keepLineMap, commentsMap);
+ Object x = new CommentCollectingParser(this, lexer, true, keepLineMap, commentsField);
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, Map<JCCompilationUnit, List<CommentInfo>> commentsMap) {
+ public static void setInCompiler(JavaCompiler compiler, Context context, ReferenceFieldAugment<JCCompilationUnit, List<CommentInfo>> commentsField) {
context.put(CommentCollectingParserFactory.key(), (ParserFactory)null);
Field field;
try {
field = JavaCompiler.class.getDeclaredField("parserFactory");
field.setAccessible(true);
- field.set(compiler, new CommentCollectingParserFactory(context, commentsMap));
+ field.set(compiler, new CommentCollectingParserFactory(context, commentsField));
} catch (Exception e) {
throw new IllegalStateException("Could not set comment sensitive parser in the compiler", e);
}