Skip to content

Commit 67cc3bd

Browse files
authored
Merge pull request #38 from IBM/rangeetpan-patch-1
Update codeanalyzer.py to add a new method that can read analysis.jso…
2 parents 18d2dd7 + a206255 commit 67cc3bd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

cldk/analysis/java/codeanalyzer/codeanalyzer.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,16 @@ def _get_codeanalyzer_exec(self) -> List[str]:
186186
codeanalyzer_jar_file = self._download_or_update_code_analyzer(codeanalyzer_jar_path)
187187
codeanalyzer_exec = shlex.split(f"java -jar {codeanalyzer_jar_file}")
188188
return codeanalyzer_exec
189-
189+
190+
def init_japplication(self, data: str) -> JApplication:
191+
"""Return JApplication giving the stringified JSON as input.
192+
Returns
193+
-------
194+
JApplication
195+
The application view of the Java code with the analysis results.
196+
"""
197+
return JApplication(**json.loads(data))
198+
190199
def _init_codeanalyzer(self, analysis_level=1) -> JApplication:
191200
"""Initializes the Codeanalyzer.
192201
Returns
@@ -1043,4 +1052,4 @@ def get_all_entry_point_classes(self) -> Dict[str, JType]:
10431052
symtab = self.get_symbol_table()
10441053
for val in symtab.values():
10451054
class_dict.update((k, v) for k, v in val.type_declarations.items() if v.is_entry_point is True)
1046-
return class_dict
1055+
return class_dict

0 commit comments

Comments
 (0)