8000 Merge pull request #119 from codellm-devkit/118-update-java-model-to-… · codellm-devkit/python-sdk@1b1c011 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1b1c011

Browse files
authored
Merge pull request #119 from codellm-devkit/118-update-java-model-to-comply-with-codeanalyzer-v231
Update Java model to comply with codeanalyzer v2.3.1
2 parents 7115e4b + 2872a12 commit 1b1c011

File tree

4 files changed

+36038
-47684
lines changed

4 files changed

+36038
-47684
lines changed

cldk/analysis/java/codeanalyzer/codeanalyzer.py

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -48,40 +48,6 @@ class JCodeanalyzer:
4848
If None, the analysis will be read from the pipe.
4949
analysis_level (str): The level of analysis ('symbol_table' or 'call_graph').
5050
eager_analysis (bool): If True, the analysis will be performed every time the object is created.
51-
52-
Methods:
53-
_init_codeanalyzer(analysis_level=1):
54-
Initializes the codeanalyzer database.
55-
56-
_download_or_update_code_analyzer(filepath: Path) -> str:
57-
Downloads the codeanalyzer jar from the latest release on GitHub.
58-
59-
_get_application() -> JApplication:
60-
Returns the application view of the Java code.
61-
62-
_get_codeanalyzer_exec() -> List[str]:
63-
Returns the executable command for codeanalyzer.
64-
65-
_codeanalyzer_single_file() -> JApplication:
66-
Invokes codeanalyzer in a single file mode.
67-
68-
get_symbol_table() -> Dict[str, JCompilationUnit]:
69-
Returns the symbol table of the Java code.
70-
71-
get_application_view() -> JApplication:
72-
Returns the application view of the Java code.
73-
74-
get_system_dependency_graph() -> list[JGraphEdges]:
75-
Runs the codeanalyzer to get the system dependency graph.
76-
77-
_generate_call_graph(using_symbol_table: bool) -> nx.DiGraph:
78-
Generates the call graph of the Java code.
79-
80-
get_class_hierarchy() -> nx.DiGraph:
81-
Returns the class hierarchy of the Java code.
82-
83-
get_call_graph() -> nx.DiGraph:
84-
Returns the call graph of the Java code.
8551
"""
8652

8753
def __init__(
@@ -276,10 +242,11 @@ def get_system_dependency_graph(self) -> list[JGraphEdges]:
276242
Returns:
277243
list[JGraphEdges]: The system dependency graph.
278244
"""
279-
if self.application.system_dependency_graph is None:
245+
if self.application.system_dependency_graph is None or self.application.call_graph is None:
280246
self.application = self._init_codeanalyzer(analysis_level=2)
281247

282-
return self.application.system_dependency_graph
248+
logger.warning("System dependency graph is not yet implemented. Returning the call graph instead.")
249+
return self.application.call_graph
283250

284251
def _generate_call_graph(self, using_symbol_table) -> nx.DiGraph:
285252
"""Generates the call graph of the Java code.

cldk/models/java/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ class JApplication(BaseModel):
477477
"""
478478

479479
symbol_table: Dict[str, JCompilationUnit]
480+
call_graph: List[JGraphEdges] = None
480481
system_dependency_graph: List[JGraphEdges] = None
481482

482483
@field_validator("symbol_table", mode="after")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "cldk"
3-
version = "0.5.0"
3+
version = "0.5.1"
44
description = "The official Python SDK for Codellm-Devkit."
55
authors = ["Rahul Krishna <i.m.ralk@gmail.com>", "Rangeet Pan <rangeet.pan@ibm.com>", "Saurabh Sinhas <sinhas@us.ibm.com>",
66
"Raju Pavuluri <pavuluri@us.ibm.com>"]

0 commit comments

Comments
 (0)
0