Lombok - v0.10.1

lombok.eclipse
Class EclipseAST

java.lang.Object
  extended by lombok.core.AST<EclipseAST,EclipseNode,org.eclipse.jdt.internal.compiler.ast.ASTNode>
      extended by lombok.eclipse.EclipseAST

public class EclipseAST
extends AST<EclipseAST,EclipseNode,org.eclipse.jdt.internal.compiler.ast.ASTNode>

Wraps around Eclipse's internal AST view to add useful features as well as the ability to visit parents from children, something Eclipse own AST system does not offer.


Nested Class Summary
 
Nested classes/interfaces inherited from class lombok.core.AST
AST.FieldAccess, AST.Kind
 
Constructor Summary
EclipseAST(org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration ast)
          Creates a new EclipseAST of the provided Compilation Unit.
 
Method Summary
protected  EclipseNode buildTree(org.eclipse.jdt.internal.compiler.ast.ASTNode node, AST.Kind kind)
          Build an AST.Node object for the stated internal (javac/Eclipse) AST Node object.
protected  Collection<Class<? extends org.eclipse.jdt.internal.compiler.ast.ASTNode>> getStatementTypes()
          For Eclipse, only Statement counts, as Expression is a subclass of it, even though this isn't entirely correct according to the JLS spec (only some expressions can be used as statements, not all of them).
 boolean isCompleteParse()
          Eclipse starts off with a 'diet' parse which leaves method bodies blank, amongst other shortcuts.
 void rebuild(boolean force)
          Call this method to move an EclipseAST generated for a diet parse to rebuild itself for the full parse - with filled in method bodies and such.
 void traverse(EclipseASTVisitor visitor)
          Runs through the entire AST, starting at the compilation unit, calling the provided visitor's visit methods for each node, depth first.
 
Methods inherited from class lombok.core.AST
buildWithField, clearChanged, clearState, fieldsOf, get, getFileName, getImportStatements, getNodeMap, getPackageDeclaration, isChanged, putInMap, replaceStatementInNode, setAndGetAsHandled, setChanged, setElementInASTCollection, setTop, top
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EclipseAST

public EclipseAST(org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration ast)
Creates a new EclipseAST of the provided Compilation Unit.

Parameters:
ast - The compilation unit, which serves as the top level node in the tree to be built.
Method Detail

traverse

public void traverse(EclipseASTVisitor visitor)
Runs through the entire AST, starting at the compilation unit, calling the provided visitor's visit methods for each node, depth first.


isCompleteParse

public boolean isCompleteParse()
Eclipse starts off with a 'diet' parse which leaves method bodies blank, amongst other shortcuts. For such diet parses, this method returns false, otherwise it returns true. Any lombok processor that needs the contents of methods should just do nothing (and return false so it gets another shot later!) when this is false.


rebuild

public void rebuild(boolean force)
Call this method to move an EclipseAST generated for a diet parse to rebuild itself for the full parse - with filled in method bodies and such. Also propagates problems and errors, which in diet parse mode can't be reliably added to the problems/warnings view.


buildTree

protected EclipseNode buildTree(org.eclipse.jdt.internal.compiler.ast.ASTNode node,
                                AST.Kind kind)
Build an AST.Node object for the stated internal (javac/Eclipse) AST Node object.

Specified by:
buildTree in class AST<EclipseAST,EclipseNode,org.eclipse.jdt.internal.compiler.ast.ASTNode>

getStatementTypes

protected Collection<Class<? extends org.eclipse.jdt.internal.compiler.ast.ASTNode>> getStatementTypes()
For Eclipse, only Statement counts, as Expression is a subclass of it, even though this isn't entirely correct according to the JLS spec (only some expressions can be used as statements, not all of them).

Specified by:
getStatementTypes in class AST<EclipseAST,EclipseNode,org.eclipse.jdt.internal.compiler.ast.ASTNode>

Lombok - v0.10.1

Copyright © 2009-2010 Reinier Zwitserloot, Roel Spilker and Robbert Jan Grootjans, licensed under the MIT licence.