-
Notifications
You must be signed in to change notification settings - Fork 1
fix(CODEWIKI-005-2): CU-86akn96pk 2 review findings in java.py #91
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -189,7 +189,7 @@ def _extract_relationships(self, node, top_level_nodes): | |
| if field_type_name and not self._is_primitive_type(field_type_name): | ||
| self.call_relationships.append(CallRelationship( | ||
| caller=containing_class, | ||
| callee=field_type_name, | ||
| callee=self._get_component_id(field_type_name), | ||
| call_line=node.start_point[0]+1, | ||
| is_resolved=False | ||
| )) | ||
|
|
@@ -224,7 +224,7 @@ def _extract_relationships(self, node, top_level_nodes): | |
| if target_type and not self._is_primitive_type(target_type): | ||
| self.call_relationships.append(CallRelationship( | ||
| caller=caller_id, | ||
| callee=target_type, | ||
| callee=self._get_component_id(target_type), | ||
| call_line=node.start_point[0]+1, | ||
| is_resolved=False | ||
| )) | ||
|
|
@@ -238,7 +238,7 @@ def _extract_relationships(self, node, top_level_nodes): | |
| if created_type and not self._is_primitive_type(created_type): | ||
| self.call_relationships.append(CallRelationship( | ||
| caller=containing_class, | ||
| callee=created_type, | ||
| callee=self._get_component_id(created_type), | ||
| call_line=node.start_point[0]+1, | ||
| is_resolved=False | ||
| )) | ||
|
|
@@ -270,8 +270,10 @@ def _get_type_name(self, node): | |
| type_node = next((c for c in node.children if c.type == "type_identifier"), None) | ||
| return type_node.text.decode() if type_node else None | ||
| elif node.type == "superclass": | ||
| type_node = next((c for c in node.children if c.type == "type_identifier"), None) | ||
| return type_node.text.decode() if type_node else None | ||
| type_node = next((c for c in node.children if c.type in ["type_identifier", "generic_type"]), None) | ||
| if type_node: | ||
| return self._get_type_name(type_node) | ||
| return None | ||
| return None | ||
|
|
||
| def _find_containing_class(self, node, top_level_nodes): | ||
|
Comment on lines
270
to
279
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π Java analyzer's superclass relationship uses wrong tree-sitter type check for base class name extraction In π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
|
|
@@ -364,3 +366,4 @@ def _find_containing_method(self, node): | |
| def analyze_java_file(file_path: str, content: str, repo_path: str = None) -> Tuple[List[Node], List[CallRelationship]]: | ||
| analyzer = TreeSitterJavaAnalyzer(file_path, content, repo_path) | ||
| return analyzer.nodes, analyzer.call_relationships | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
𦩠π΄ Java analyzer builds component IDs for classes/interfaces without checking they use the double-colon FQDN format consistently for nested class members
In
_extract_relationships(java.py), the field-type-use block (section 3) now wrapsfield_type_namewithself._get_component_id(field_type_name)before assigning it tocallee, and the object-creation block (section 5) now wrapscreated_typewithself._get_component_id(created_type)before assigning it tocallee. This ensures both relationship types emit canonicalmodule.path::ClassNameFQDN callee ids consistent with the inheritance/interface/method-call relationships, matching CODEWIKI-005-2/CODEWIKI-008 requirements. Additionally, the method-invocation block (section 4) had the same bare-name bug fortarget_typeand was fixed the same way for full consistency, since it exhibited the identical defect pattern described by the finding.π€ Prompt for AI agents
fix confidence: π’ 90 high β react π/π to teach the reviewer