addResult()
Adds a result using the scanner's current TreePath, without any comment.
void
addResult(String note)
Adds a result using the scanner's current TreePath.
void
addResult(TreePath path,
String note)
Forward a result (query match) to the query's context.
void
attach(org.netbeans.api.java.source.CompilationInfo info)
Attach this Query instance to the specified CompilationInfo prior
to processing one or more source files.
void
destroy()
Release any instance data shared by invocations, including all references
to the JavaSource instanced passed to init().
org.netbeans.api.java.source.CompilationInfo
getCompilationInfo()
Returns the CompilationInfo attached to this query.
getContext()
Returns the context the query is executing within.
org.netbeans.api.java.source.JavaSource
getJavaSource()
Returns the JavaSource this query was initialized with.
void
init(QueryContext context,
org.netbeans.api.java.source.JavaSource source)
Initialize any data that is shared across source file processing
invocations.
void
release()
Release any instance data created by attach() or the processing of
a set of source files.
void
run()
Execute the query for the set of source files.
Methods inherited from class org.netbeans.api.java.source.support.CancellableTreePathScanner
cancel, isCanceled, scan, scan
Methods inherited from class com.sun.source.util.TreePathScanner
Release any instance data created by attach() or the processing of
a set of source files. All references to the attached CompilationInfo
and its source files must be released.
Returns the context the query is executing within.
Returns:
the query's context
addResult
public final void addResult()
Adds a result using the scanner's current TreePath, without any comment.
This method is normally called only from queries that match on a single
condition, such as FindUnusedVariables where a variable is only added
if it is unused. Queries which match on multiple possible conditions
should include a comment giving the user a reason for the specific
result.