org.netbeans.api.java.source
public class CompilationInfo extends Object
Modifier and Type | Method and Description |
---|---|
protected void |
doInvalidate() |
static CompilationInfo |
get(org.netbeans.modules.parsing.spi.Parser.Result result)
Returns an instance of the
CompilationInfo for
given Parser.Result if it is a result
of a java parser. |
TreePath |
getChangedTree()
Returns tree which was reparsed by an incremental reparse.
|
ClasspathInfo |
getClasspathInfo()
Returns
ClasspathInfo for which this CompilationInfo was created. |
CompilationUnitTree |
getCompilationUnit()
Returns the javac tree representing the source file.
|
List<Diagnostic> |
getDiagnostics()
Returns the errors in the file represented by the
JavaSource . |
Document |
getDocument()
Returns
Document of this CompilationInfoImpl |
Elements |
getElements()
Return the
Elements service of the javac represented by this CompilationInfo . |
ElementUtilities |
getElementUtilities()
Returns
ElementUtilities . |
FileObject |
getFileObject()
Returns the
FileObject represented by this CompilationInfo . |
JavaSource |
getJavaSource()
Deprecated.
Works only when the CompilationInfo was created by JavaSource using
the compatibility bridge, when the CompilationInfo was created by the parsing api
it returns null. Use
getSnapshot() instead. |
JavaSource.Phase |
getPhase()
Returns the current phase of the
JavaSource . |
PositionConverter |
getPositionConverter()
Deprecated.
as of 0.42, this is superseded by Parsing API.
|
org.netbeans.modules.parsing.api.Snapshot |
getSnapshot()
Returns the snapshot used by java parser
|
SourceVersion |
getSourceVersion()
Returns the
SourceVersion used by the javac represented by this CompilationInfo . |
String |
getText()
Returns the content of the file represented by the
JavaSource . |
TokenHierarchy<?> |
getTokenHierarchy()
Returns the
TokenHierarchy for the file represented by the JavaSource . |
List<? extends TypeElement> |
getTopLevelElements()
Returns all top level elements defined in file for which the
CompilationInfo
was created. |
Trees |
getTrees()
Return the
Trees service of the javac represented by this CompilationInfo . |
TreeUtilities |
getTreeUtilities()
Returns
TreeUtilities . |
Types |
getTypes()
Return the
Types service of the javac represented by this CompilationInfo . |
TypeUtilities |
getTypeUtilities()
Get the TypeUtilities.
|
@NullUnknown public static CompilationInfo get(@NonNull org.netbeans.modules.parsing.spi.Parser.Result result)
CompilationInfo
for
given Parser.Result
if it is a result
of a java parser.result
- for which the CompilationInfo
should be
returned.CompilationInfo
or null when the given result
is not a result of java parsing.@NonNull public JavaSource.Phase getPhase()
JavaSource
.JavaSource.Phase
the state which was reached by the JavaSource
.@CheckForNull @CheckReturnValue public TreePath getChangedTree()
Currently the leaf tree is a MethodTree but this may change in the future. Client of this method is responsible to check the corresponding TreeKind to find out if it may perform on the changed subtree or it needs to reprocess the whole tree.
TreePath
or nullpublic CompilationUnitTree getCompilationUnit()
CompilationUnitTree
the compilation unit containing the top level classes contained in the,
java source file.IllegalStateException
- when the phase is less than JavaSource.Phase.PARSED
@NonNull public String getText()
JavaSource
.@NonNull public org.netbeans.modules.parsing.api.Snapshot getSnapshot()
@NonNull public TokenHierarchy<?> getTokenHierarchy()
TokenHierarchy
for the file represented by the JavaSource
.@NonNull public List<Diagnostic> getDiagnostics()
JavaSource
.Diagnostic
@NullUnknown public List<? extends TypeElement> getTopLevelElements() throws IllegalStateException
CompilationInfo
was created. The CompilationInfo
has to be in phase JavaSource#Phase#ELEMENTS_RESOLVED
.CompilationInfo
is not
in phase JavaSource#Phase#ELEMENTS_RESOLVED
or higher.IllegalStateException
- is thrown when the JavaSource
was created with no files@NonNull public Trees getTrees()
Trees
service of the javac represented by this CompilationInfo
.@NonNull public Types getTypes()
Types
service of the javac represented by this CompilationInfo
.@NonNull public Elements getElements()
Elements
service of the javac represented by this CompilationInfo
.@NullUnknown public JavaSource getJavaSource()
getSnapshot()
instead.JavaSource
for which this CompilationInfo
was created.@NonNull public ClasspathInfo getClasspathInfo()
ClasspathInfo
for which this CompilationInfo
was created.@NullUnknown public FileObject getFileObject()
FileObject
represented by this CompilationInfo
.@Deprecated public PositionConverter getPositionConverter()
PositionConverter
binding virtual Java source and the real source.
Please note that this method is needed only for clients that need to work
in non-Java files (e.g. JSP files) or in dialogs, like code completion.
Most clients do not need to use PositionConverter
.@CheckForNull public Document getDocument() throws IOException
Document
of this CompilationInfoImpl
DataObject
doesn't
exist or has no EditorCookie
.IOException
@NonNull public TreeUtilities getTreeUtilities()
TreeUtilities
.@NonNull public ElementUtilities getElementUtilities()
ElementUtilities
.@NonNull public TypeUtilities getTypeUtilities()
@NonNull public SourceVersion getSourceVersion()
SourceVersion
used by the javac represented by this CompilationInfo
.protected void doInvalidate()
Built on March 18 2014. | Portions Copyright 1997-2014 Sun Microsystems, Inc. All rights reserved.