aboutsummaryrefslogtreecommitdiff
path: root/src/delombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-11-27 00:38:58 +0100
committerReinier Zwitserloot <reinier@tipit.to>2009-11-27 00:38:58 +0100
commite5d248c3ccf64211fd8a301f584bde82dd426601 (patch)
tree5f9000e70adc10b24e009f611c068eba99a31a6e /src/delombok
parentf22021ca7808af2cd0ba03b7c34b8fd3758ff44b (diff)
downloadlombok-e5d248c3ccf64211fd8a301f584bde82dd426601.tar.gz
lombok-e5d248c3ccf64211fd8a301f584bde82dd426601.tar.bz2
lombok-e5d248c3ccf64211fd8a301f584bde82dd426601.zip
delombok now calls lombok. wahey!
Diffstat (limited to 'src/delombok')
-rw-r--r--src/delombok/lombok/delombok/CommentPreservingParser.java32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/delombok/lombok/delombok/CommentPreservingParser.java b/src/delombok/lombok/delombok/CommentPreservingParser.java
index 19219d93..51df5ed1 100644
--- a/src/delombok/lombok/delombok/CommentPreservingParser.java
+++ b/src/delombok/lombok/delombok/CommentPreservingParser.java
@@ -23,6 +23,15 @@ package lombok.delombok;
import java.io.IOException;
import java.io.Writer;
+import java.util.Collections;
+
+import javax.annotation.processing.Messager;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.AnnotationValue;
+import javax.lang.model.element.Element;
+import javax.tools.Diagnostic.Kind;
+
+import lombok.javac.JavacTransformer;
import com.sun.tools.javac.main.JavaCompiler;
import com.sun.tools.javac.main.OptionName;
@@ -64,9 +73,30 @@ public class CommentPreservingParser {
comments.comments = List.nil();
@SuppressWarnings("deprecation")
JCCompilationUnit cu = compiler.parse(fileName);
+
+ new JavacTransformer(messager).transform(context, Collections.singleton(cu));
+
return new ParseResult(comments.comments, cu);
}
-
+
+ private static final Messager messager = new Messager() {
+ @Override public void printMessage(Kind kind, CharSequence msg) {
+ System.out.printf("M: %s: %s\n", kind, msg);
+ }
+
+ @Override public void printMessage(Kind kind, CharSequence msg, Element e) {
+ System.out.printf("E: %s: %s\n", kind, msg);
+ }
+
+ @Override public void printMessage(Kind kind, CharSequence msg, Element e, AnnotationMirror a) {
+ System.out.printf("A: %s: %s\n", kind, msg);
+ }
+
+ @Override public void printMessage(Kind kind, CharSequence msg, Element e, AnnotationMirror a, AnnotationValue v) {
+ System.out.printf("V: %s: %s\n", kind, msg);
+ }
+ };
+
static class Comments {
List<Comment> comments = List.nil();