public class DependencyTracker
extends ClassCodeVisitorSupport
Tracks type dependencies referenced from a source unit and stores them in a StringSetMap.
| Constructor and description |
|---|
DependencyTracker(SourceUnit source, StringSetMap cache)Creates a dependency tracker for a source unit. |
DependencyTracker(SourceUnit source, StringSetMap cache, Map<String, ?> precompiledEntries)Creates a dependency tracker for a source unit with an explicit set of precompiled dependency entries. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected SourceUnit |
getSourceUnit()Returns the source unit whose dependencies are being tracked. |
|
public void |
visitAnnotations(AnnotatedNode node)Records the types of annotations attached to the supplied node. |
|
public void |
visitArrayExpression(ArrayExpression expression)Records the array type referenced by an array expression. |
|
public void |
visitCastExpression(CastExpression expression)Records the target type referenced by a cast expression. |
|
public void |
visitCatchStatement(CatchStatement statement)Records the exception-variable type referenced by a catch statement. |
|
public void |
visitClass(ClassNode node)Visits a class and records its direct type dependencies. |
|
public void |
visitClassExpression(ClassExpression expression)Records the type referenced by a class literal expression. |
|
public void |
visitConstructorCallExpression(ConstructorCallExpression call)Records the constructed type referenced by a constructor call. |
|
public void |
visitField(FieldNode node)Records the declared type of a visited field. |
|
public void |
visitMethod(MethodNode node)Records parameter, return, and exception types referenced by a method. |
|
public void |
visitVariableExpression(VariableExpression expression)Records the type referenced by a variable expression. |
Creates a dependency tracker for a source unit.
source - the source unit being analyzedcache - the dependency cache to populateCreates a dependency tracker for a source unit with an explicit set of precompiled dependency entries.
source - the source unit being analyzedcache - the dependency cache to populateprecompiledEntries - precompiled classes considered valid
dependenciesReturns the source unit whose dependencies are being tracked.
Records the types of annotations attached to the supplied node.
node - the annotated node being visitedRecords the array type referenced by an array expression.
expression - the array expression being visitedRecords the target type referenced by a cast expression.
expression - the cast expression being visitedRecords the exception-variable type referenced by a catch statement.
statement - the catch statement being visitedVisits a class and records its direct type dependencies.
node - the class being visitedRecords the type referenced by a class literal expression.
expression - the class expression being visitedRecords the constructed type referenced by a constructor call.
call - the constructor call expression being visitedRecords the declared type of a visited field.
node - the field being visitedRecords parameter, return, and exception types referenced by a method.
node - the method being visitedRecords the type referenced by a variable expression.
expression - the variable expression being visitedCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.