diff --git a/cldk/analysis/java/codeanalyzer/codeanalyzer.py b/cldk/analysis/java/codeanalyzer/codeanalyzer.py index 8bd3e17..83562a7 100644 --- a/cldk/analysis/java/codeanalyzer/codeanalyzer.py +++ b/cldk/analysis/java/codeanalyzer/codeanalyzer.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. ################################################################################ - +from pdb import set_trace import re import json import shlex diff --git a/cldk/models/java/models.py b/cldk/models/java/models.py index c156268..2579bb8 100644 --- a/cldk/models/java/models.py +++ b/cldk/models/java/models.py @@ -20,7 +20,7 @@ import re from contextvars import ContextVar from typing import Dict, List, Optional - +from pdb import set_trace from pydantic import BaseModel, field_validator, model_validator from .constants_namespace import ConstantsNamespace @@ -412,9 +412,11 @@ class JApplication(BaseModel): @field_validator("symbol_table", mode="after") @classmethod - def validate_source(cls, symbol_table): + def validate_source(cls, symbol_table) -> Dict[str, JCompilationUnit]: # Populate the lookup table for callables for _, j_compulation_unit in symbol_table.items(): for type_declaration, jtype in j_compulation_unit.type_declarations.items(): for __, j_callable in jtype.callable_declarations.items(): _CALLABLES_LOOKUP_TABLE[(type_declaration, j_callable.signature)] = j_callable + + return symbol_table diff --git a/pyproject.toml b/pyproject.toml index 346b2f7..6acc889 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cldk" -version = "0.3.0" +version = "0.4.0" description = "codellm-devkit: A python library for seamless integration with LLMs." authors = ["Rahul Krishna ", "Rangeet Pan ", "Saurabh Sinhas ", "Raju Pavuluri "] diff --git a/tests/analysis/java/test_java.py b/tests/analysis/java/test_java.py index 839680f..b7ff41b 100644 --- a/tests/analysis/java/test_java.py +++ b/tests/analysis/java/test_java.py @@ -1,9 +1,23 @@ +from pdb import set_trace from cldk import CLDK from typing import List, Tuple from cldk.analysis import AnalysisLevel from cldk.models.java.models import JMethodDetail +def test_get_symbol_table_is_not_null(test_fixture, codeanalyzer_jar_path): + # Initialize the CLDK object with the project directory, language, and analysis_backend. + cldk = CLDK(language="java") + analysis = cldk.analysis( + project_path=test_fixture, + analysis_backend="codeanalyzer", + analysis_backend_path=codeanalyzer_jar_path, + eager=True, + analysis_level=AnalysisLevel.call_graph, + ) + assert analysis.get_symbol_table() is not None + + def test_get_class_call_graph(test_fixture, codeanalyzer_jar_path): # Initialize the CLDK object with the project directory, language, and analysis_backend. cldk = CLDK(language="java")