MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _java_annotation_names

Function _java_annotation_names

graphify/extractors/engine.py:1097–1114  ·  view source on GitHub ↗

Collect ``(simple, raw)`` annotation names from a Java declaration's `modifiers` child. ``raw`` keeps the dotted qualifier of an inline-qualified annotation (``@org.pkg.Foo``); it equals ``simple`` when unqualified.

(declaration_node, source: bytes)

Source from the content-addressed store, hash-verified

1095
1096
1097def _java_annotation_names(declaration_node, source: bytes) -> list[tuple[str, str]]:
1098 """Collect ``(simple, raw)`` annotation names from a Java declaration's
1099 `modifiers` child. ``raw`` keeps the dotted qualifier of an inline-qualified
1100 annotation (``@org.pkg.Foo``); it equals ``simple`` when unqualified."""
1101 names: list[tuple[str, str]] = []
1102 for anno in _java_annotation_nodes(declaration_node):
1103 name_node = anno.child_by_field_name("name")
1104 if name_node is None:
1105 for sub in anno.children:
1106 if sub.type in ("identifier", "scoped_identifier", "type_identifier"):
1107 name_node = sub
1108 break
1109 if name_node is not None:
1110 raw = _read_text(name_node, source)
1111 text = raw.rsplit(".", 1)[-1]
1112 if text:
1113 names.append((text, raw))
1114 return names
1115
1116
1117def _java_annotation_class_literal_refs(

Callers 1

walkFunction · 0.85

Calls 2

_read_textFunction · 0.90
_java_annotation_nodesFunction · 0.85

Tested by

no test coverage detected