Skip to content

Fix issue 67 #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cldk/analysis/java/codeanalyzer/codeanalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions cldk/models/java/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <i.m.ralk@gmail.com>", "Rangeet Pan <rangeet.pan@ibm.com>", "Saurabh Sinhas <sinhas@us.ibm.com>",
"Raju Pavuluri <pavuluri@us.ibm.com>"]
Expand Down
14 changes: 14 additions & 0 deletions tests/analysis/java/test_java.py
Original file line number Diff line number Diff line change
@@ -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")
Expand Down