1515class JavaAnalysis (SymbolTable , CallGraph ):
1616
1717 def __init__ (
18- self ,
19- project_dir : str | Path | None ,
20- source_code : str | None ,
21- analysis_backend : str ,
22- analysis_backend_path : str | None ,
23- analysis_json_path : str | Path | None ,
24- analysis_level : str ,
25- use_graalvm_binary : bool ,
26- eager_analysis : bool ,
18+ self ,
19+ project_dir : str | Path | None ,
20+ source_code : str | None ,
21+ analysis_backend : str ,
22+ analysis_backend_path : str | None ,
23+ analysis_json_path : str | Path | None ,
24+ analysis_level : str ,
25+ target_files : List [str ] | None ,
26+ use_graalvm_binary : bool ,
27+ eager_analysis : bool ,
2728 ) -> None :
2829 """
2930 Parameters
@@ -44,7 +45,9 @@ def __init__(
4445 eager_analysis : bool, optional
4546 A flag indicating whether to perform eager analysis, defaults to False. If True, the analysis is performed
4647 eagerly. That is, the analysis.json file is created during analysis every time even if it already exists.
47-
48+ target_files: str, optional
49+ The target files for which the analysis will run or get modified. Currently, this feature only supported
50+ with symbol table analysis. In the future, we will add this feature to other analysis levels.
4851 Attributes
4952 ----------
5053 analysis_backend : JCodeQL | JApplication
@@ -59,7 +62,8 @@ def __init__(
5962 self .analysis_backend_path = analysis_backend_path
6063 self .eager_analysis = eager_analysis
6164 self .use_graalvm_binary = use_graalvm_binary
62- self .analysis_backend = analysis_backend
65+ self .analysis_backend = analysis_backend
66+ self .target_files = target_files
6367 # Initialize the analysis analysis_backend
6468 if analysis_backend .lower () == "codeql" :
6569 self .analysis_backend : JCodeQL = JCodeQL (self .project_dir , self .analysis_json_path )
@@ -72,6 +76,7 @@ def __init__(
7276 analysis_json_path = self .analysis_json_path ,
7377 use_graalvm_binary = self .use_graalvm_binary ,
7478 analysis_backend_path = self .analysis_backend_path ,
79+ target_files = self .target_files
7580 )
7681 else :
7782 raise NotImplementedError (f"Support for { analysis_backend } has not been implemented yet." )
@@ -438,7 +443,9 @@ def get_implemented_interfaces(self, qualified_class_name) -> List[str]:
438443 raise NotImplementedError (f"Support for this functionality has not been implemented yet." )
439444 return self .backend .get_implemented_interfaces (qualified_class_name )
440445
441- def __get_class_call_graph_using_symbol_table (self , qualified_class_name : str , method_signature : str | None = None ) -> (List )[Tuple [JMethodDetail , JMethodDetail ]]:
446+ def __get_class_call_graph_using_symbol_table (self , qualified_class_name : str ,
447+ method_signature : str | None = None ) -> (List )[
448+ Tuple [JMethodDetail , JMethodDetail ]]:
442449 """
443450 A call graph using symbol table for a given class and a given method.
444451 Args:
@@ -478,7 +485,7 @@ def get_class_call_graph(self, qualified_class_name: str, method_signature: str
478485 """
479486 if using_symbol_table :
480487 return self .__get_class_call_graph_using_symbol_table (qualified_class_name = qualified_class_name ,
481- method_signature = method_signature )
488+ method_signature = method_signature )
482489 if self .analysis_backend in [AnalysisEngine .CODEQL , AnalysisEngine .TREESITTER ]:
483490 raise NotImplementedError (f"Support for this functionality has not been implemented yet." )
484491 return self .backend .get_class_call_graph (qualified_class_name , method_signature )
0 commit comments