Package cs1302.tracer.trace
Class SourceAnalysis
java.lang.Object
cs1302.tracer.trace.SourceAnalysis
Precomputes and caches immutable source-derived AST indexes, type resolution hierarchies,
and lambda analysis for the lifetime of a tracing session to avoid per-snapshot re-indexing.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the precomputed AstTypeResolver instance.static SourceAnalysisempty()Returns an empty SourceAnalysis instance.Returns the map of method signatures to final local variable names.Optional<com.github.javaparser.ast.body.ClassOrInterfaceDeclaration> findClassDeclaration(String className) Finds the cached ClassOrInterfaceDeclaration for a class name or FQN.findStaticLambdaImplementation(String className, String fieldName) Finds the cached static lambda implementation text for a static field.static SourceAnalysisBuilds and indexes source information from a list of compilation units.Returns the map of method signatures to lambda assignments.List<com.github.javaparser.ast.CompilationUnit> Returns the underlying parsed compilation units.
-
Method Details
-
empty
Returns an empty SourceAnalysis instance.- Returns:
- Empty SourceAnalysis.
-
from
Builds and indexes source information from a list of compilation units.- Parameters:
parsedSources- List of parsed CompilationUnits.- Returns:
- SourceAnalysis instance containing pre-indexed AST metadata.
-
parsedSources
Returns the underlying parsed compilation units.- Returns:
- List of compilation units.
-
astTypeResolver
Returns the precomputed AstTypeResolver instance.- Returns:
- AstTypeResolver instance.
-
lambdaMethodAssignments
public Map<String,List<cs1302.tracer.trace.DebugTraceHelper.LambdaAssignment>> lambdaMethodAssignments()Returns the map of method signatures to lambda assignments.- Returns:
- Lambda method assignments map.
-
finalMethodVariables
Returns the map of method signatures to final local variable names.- Returns:
- Final method variables map.
-
findClassDeclaration
public Optional<com.github.javaparser.ast.body.ClassOrInterfaceDeclaration> findClassDeclaration(String className) Finds the cached ClassOrInterfaceDeclaration for a class name or FQN.- Parameters:
className- Class name or fully-qualified name.- Returns:
- Optional containing the declaration if found.
-
findStaticLambdaImplementation
Finds the cached static lambda implementation text for a static field.- Parameters:
className- Class name.fieldName- Field name.- Returns:
- Optional containing lambda implementation text if present.
-