diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-06-17 10:43:39 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-06-17 10:43:39 +0200 |
commit | 024d8ffa9801f463fecadd16f42d51bbed46dea7 (patch) | |
tree | acb0b85f79eafb517e3472bd3d906235d1541ade /src/lombok/javac/JavacNode.java | |
parent | aa6d2e262f3d6c43f6d89220cdc10c6954bb2bdd (diff) | |
download | lombok-024d8ffa9801f463fecadd16f42d51bbed46dea7.tar.gz lombok-024d8ffa9801f463fecadd16f42d51bbed46dea7.tar.bz2 lombok-024d8ffa9801f463fecadd16f42d51bbed46dea7.zip |
Massive refactors. This list isn't complete, but should give you an idea:
A) many things in lombok.eclipse moved to lombok.core to enable reuse with lombok.javac.
B) lombok.javac works now similarly to eclipse's model: We first make big ASTs that are bidirectionally traversable, then we walk through that for annotations.
C) Instead of getting an annotation instance, you now get an object that is more flexible and can e.g. give you class values in an enum as a string instead of a Class object, which may fail if that class isn't on the classpath of lombok.
D) sources to the internal sun classes for javac added to /contrib.
Diffstat (limited to 'src/lombok/javac/JavacNode.java')
-rw-r--r-- | src/lombok/javac/JavacNode.java | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/src/lombok/javac/JavacNode.java b/src/lombok/javac/JavacNode.java deleted file mode 100644 index 2e65e1d1..00000000 --- a/src/lombok/javac/JavacNode.java +++ /dev/null @@ -1,63 +0,0 @@ -package lombok.javac; - -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.lang.model.element.TypeElement; -import javax.tools.Diagnostic; - -import com.sun.source.util.Trees; -import com.sun.tools.javac.processing.JavacProcessingEnvironment; -import com.sun.tools.javac.tree.TreeMaker; -import com.sun.tools.javac.tree.JCTree.JCClassDecl; -import com.sun.tools.javac.util.Name; - -public class JavacNode { - private final Element node; - private final Messager messager; - private final JavacProcessingEnvironment env; - private final Trees trees; - - public JavacNode(Trees trees, JavacProcessingEnvironment env, Element node) { - this.trees = trees; - this.env = env; - this.node = node; - this.messager = env.getMessager(); - } - - public Element getJavacAST() { - return node; - } - - public JCClassDecl getEnclosingType() { - Element parent = node; - while ( !(parent instanceof TypeElement) ) parent = node.getEnclosingElement(); - TypeElement classElement = (TypeElement)parent; - return (JCClassDecl)trees.getTree(classElement); - } - - public Name.Table createNameTable() { - return Name.Table.instance(env.getContext()); - } - - public TreeMaker createTreeMaker() { - return TreeMaker.instance(env.getContext()); - } - - public void addError(String message) { - this.messager.printMessage(Diagnostic.Kind.ERROR, message, node); - } - - public void addError(String message, AnnotationMirror mirror, AnnotationValue value) { - this.messager.printMessage(Diagnostic.Kind.ERROR, message, node, mirror, value); - } - - public void addWarning(String message) { - this.messager.printMessage(Diagnostic.Kind.WARNING, message, node); - } - - public void addWarning(String message, AnnotationMirror mirror, AnnotationValue value) { - this.messager.printMessage(Diagnostic.Kind.WARNING, message, node, mirror, value); - } -} |