Emit INJECTS edges for Spring DI injection points in a Java class. Handles three patterns: - @Autowired / @Inject / @Resource field injection - @Autowired constructor injection - Lombok @RequiredArgsConstructor / @AllArgsConstructor with final fields
(
self,
class_node,
class_name: str,
class_annotations: list[str],
language: str,
file_path: str,
edges: list[EdgeInfo],
)
| 3875 | return names |
| 3876 | |
| 3877 | def _emit_spring_injections( |
| 3878 | self, |
| 3879 | class_node, |
| 3880 | class_name: str, |
| 3881 | class_annotations: list[str], |
| 3882 | language: str, |
| 3883 | file_path: str, |
| 3884 | edges: list[EdgeInfo], |
| 3885 | ) -> None: |
| 3886 | """Emit INJECTS edges for Spring DI injection points in a Java class. |
| 3887 | |
| 3888 | Handles three patterns: |
| 3889 | - @Autowired / @Inject / @Resource field injection |
| 3890 | - @Autowired constructor injection |
| 3891 | - Lombok @RequiredArgsConstructor / @AllArgsConstructor with final fields |
| 3892 | """ |
| 3893 | if language != "java": |
| 3894 | return |
| 3895 | |
| 3896 | has_lombok_constructor = any( |
| 3897 | a in _LOMBOK_CONSTRUCTOR_ANNOTATIONS for a in class_annotations |
| 3898 | ) |
| 3899 | qualified_source = self._qualify(class_name, file_path, None) |
| 3900 | |
| 3901 | # Find the class body |
| 3902 | for node in class_node.children: |
| 3903 | if node.type != "class_body": |
| 3904 | continue |
| 3905 | for member in node.children: |
| 3906 | if member.type == "field_declaration": |
| 3907 | self._emit_spring_field_injection( |
| 3908 | member, qualified_source, file_path, |
| 3909 | edges, has_lombok_constructor, |
| 3910 | ) |
| 3911 | elif member.type == "constructor_declaration": |
| 3912 | self._emit_spring_constructor_injection( |
| 3913 | member, qualified_source, file_path, edges, |
| 3914 | ) |
| 3915 | |
| 3916 | def _emit_spring_field_injection( |
| 3917 | self, |
no test coverage detected