Extract Java import statement
(self, match)
| 756 | return imports |
| 757 | |
| 758 | def _extract_java_import(self, match) -> Optional[ImportInfo]: |
| 759 | """Extract Java import statement""" |
| 760 | import_path = match.group(2) |
| 761 | |
| 762 | # Resolve to file path |
| 763 | file_path = self._resolve_java_path(import_path) |
| 764 | # If not resolved, use import_path as-is (stdlib or external package) |
| 765 | if not file_path: |
| 766 | file_path = import_path |
| 767 | |
| 768 | # Determine import type |
| 769 | if import_path.endswith('.*'): |
| 770 | import_type = 'namespace' |
| 771 | items = ['*'] |
| 772 | else: |
| 773 | import_type = 'named' |
| 774 | items = [import_path.split('.')[-1]] |
| 775 | |
| 776 | return ImportInfo( |
| 777 | source_file=file_path, |
| 778 | raw_statement=match.group(0), |
| 779 | imported_items=items, |
| 780 | import_type=import_type) |
| 781 | |
| 782 | def _resolve_java_path(self, import_path: str) -> Optional[str]: |
| 783 | """Resolve Java import to file path""" |
no test coverage detected