Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

feat: JVM type-ref resolution and annotation-processor symbol synthesis (#274)

Raghav Chamadiyaa2cbdef33afb
diff --git a/packages/core/src/repowise/core/ingestion/extractors/heritage/java.py b/packages/core/src/repowise/core/ingestion/extractors/heritage/java.py
index 466fa621e..f30b70c1b 100644
--- a/packages/core/src/repowise/core/ingestion/extractors/heritage/java.py
+++ b/packages/core/src/repowise/core/ingestion/extractors/heritage/java.py
@@ -26,6 +26,33 @@ def _extract_java_heritage(
)
)
+ # `sealed class Foo permits A, B {}` — emit a permits edge in BOTH
+ # directions so the analyzer treats the sealed hierarchy as a closed
+ # set. Parent → child = "extends" (the permits clause is the
+ # inverse of the children's own ``extends Foo``), letting the parent
+ # file reach every permitted subclass even when no other code references
+ # those subclasses directly.
+ for child in def_node.children:
+ if child.type != "permits":
+ continue
+ for sub in child.children:
+ if sub.type != "type_list":
+ continue
+ for type_node in sub.children:
+ if type_node.type in (",", "permits"):
+ continue
+ permit_name = node_text(type_node, src).strip().split(".")[-1]
+ if not permit_name:
+ continue
+ out.append(
+ HeritageRelation(
+ child_name=permit_name,
+ parent_name=name,
+ kind="extends",
+ line=line,
+ )
+ )
+
interfaces = def_node.child_by_field_name("interfaces")
# Java interface declarations use `extends_interfaces` for the parent list.
if interfaces is None:
diff --git a/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols.py b/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols.py
deleted file mode 100644
index 8b79b3564..000000000
--- a/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols.py
+++ /dev/null
@@ -1,249 +0,0 @@
-"""Per-language synthetic-symbol passes.
-
-Some frameworks rely on source generators that emit symbols at compile
-time. Those generated symbols don't appear in the AST of the user's
-source file, but they ARE referenced by name from other code (XAML
-bindings, code-behind, etc.). Without representing them in the symbol
-table, every binding to such a name looks like an unresolved reference
-and the user-visible symbol that "backs" it looks orphaned.
-
-This module synthesises those names directly from the user-authored
-attributes. No filesystem coupling to ``obj/Generated/*.g.cs``.
-
-Supported today (CommunityToolkit.Mvvm):
- - ``[ObservableProperty] private string _name;`` → property ``Name``
- - ``[RelayCommand] private void Save() { … }`` → method ``SaveCommand``
-
-The dispatcher is keyed by language and returns extra ``Symbol``
-instances that the parser appends to its main symbol list. Adding a
-new framework's generator support is one function plus one entry in
-``_SYNTHETIC_EXTRACTORS``.
-"""
-
-from __future__ import annotations
-
-import re
-from collections.abc import Callable
-from typing import TYPE_CHECKING
-
-from ..models import FileInfo, Symbol
-from .helpers import node_text
-
-if TYPE_CHECKING:
- from tree_sitter import Node
-
-
-# Match the *bare* attribute name inside ``[Name]`` or ``[Name(args)]``.
-# The grammar nests attributes under ``attribute_list`` / ``attribute``
-# nodes; we look for the bare name text rather than relying on field
-# names so the pass is robust across grammar versions.
-_OBSERVABLE_PROPERTY = "ObservableProperty"
-_RELAY_COMMAND = "RelayCommand"
-
-_FIELD_NAME_TO_PROP_RE = re.compile(r"^_?([A-Za-z])(.*)$")
-
-
-def _pascal_from_field(field_name: str) -> str | None:
- """Convert ``_name`` / ``m_name`` / ``name`` → ``Name``.
-
- Returns ``None`` when the result would be empty or non-identifier.
- """
- stripped = field_name.lstrip("_")
- if stripped.startswith("m_"):
- stripped = stripped[2:]
- match = _FIELD_NAME_TO_PROP_RE.match(stripped)
- if not match:
- return None
- first, rest = match.groups()
- return first.upper() + rest
-
-
-def _attribute_names(attr_list_node: Node, src: str) -> set[str]:
- """Return the set of bare attribute names declared in an ``attribute_list``.
-
- ``[ObservableProperty]`` → ``{"ObservableProperty"}``.
- ``[RelayCommand(CanExecute=nameof(CanSave))]`` → ``{"RelayCommand"}``.
- """
- names: set[str] = set()
- for child in attr_list_node.children:
- if child.type != "attribute":
- continue
- # The first ``identifier`` / ``qualified_name`` child is the
- # attribute's name. Strip any namespace prefix.
- for sub in child.children:
- if sub.type in ("identifier", "qualified_name"):
- text = node_text(sub, src).strip()
- names.add(text.split(".")[-1])
- break
- return names
-
-
-def _csharp_synthetic_symbols(
- root: Node, src: str, file_info: FileInfo
-) -> list[Symbol]:
- """Emit synthetic symbols for CommunityToolkit MVVM attributes.
-
- Walks the file once looking for ``field_declaration`` and
- ``method_declaration`` nodes; for each, scans preceding
- ``attribute_list`` children for the trigger attribute.
- """
- out: list[Symbol] = []
- stack: list[Node] = [root]
- while stack:
- node = stack.pop()
- if node.type == "field_declaration":
- sym = _maybe_observable_property(node, src, file_info)
- if sym is not None:
- out.append(sym)
- elif node.type == "method_declaration":
- sym = _maybe_relay_command(node, src, file_info)
- if sym is not None:
- out.append(sym)
- stack.extend(node.children)
- return out
-
-
-def _maybe_observable_property(
- field_node: Node, src: str, file_info: FileInfo
-) -> Symbol | None:
- """If *field_node* is ``[ObservableProperty] private T _name;``, synthesise ``Name``."""
- if not _has_attribute(field_node, _OBSERVABLE_PROPERTY, src):
- return None
- # Locate the variable_declarator → identifier for the field name.
- field_name = _first_field_name(field_node, src)
- if not field_name:
- return None
- prop_name = _pascal_from_field(field_name)
- if not prop_name or prop_name == field_name:
- return None
- parent = _enclosing_type_name(field_node, src)
- start_line = field_node.start_point[0] + 1
- end_line = field_node.end_point[0] + 1
- return _build_synthetic_symbol(
- name=prop_name,
- kind="variable", # auto-properties surface as ``variable`` everywhere else
- signature=f"public T {prop_name} {{ get; set; }}",
- start_line=start_line,
- end_line=end_line,
- file_info=file_info,
- parent_name=parent,
- )
-
-
-def _maybe_relay_command(
- method_node: Node, src: str, file_info: FileInfo
-) -> Symbol | None:
- """If *method_node* is ``[RelayCommand] void Save() { … }``, synthesise ``SaveCommand``."""
- if not _has_attribute(method_node, _RELAY_COMMAND, src):
- return None
- method_name = _first_method_name(method_node, src)
- if not method_name:
- return None
- command_name = f"{method_name}Command"
- parent = _enclosing_type_name(method_node, src)
- start_line = method_node.start_point[0] + 1
- end_line = method_node.end_point[0] + 1
- return _build_synthetic_symbol(
- name=command_name,
- kind="variable",
- signature=f"public IRelayCommand {command_name} {{ get; }}",
- start_line=start_line,
- end_line=end_line,
- file_info=file_info,
- parent_name=parent,
- )
-
-
-def _has_attribute(node: Node, attr_name: str, src: str) -> bool:
- for child in node.children:
- if child.type == "attribute_list" and attr_name in _attribute_names(child, src):
- return True
- return False
-
-
-def _first_field_name(field_node: Node, src: str) -> str | None:
- for child in field_node.children:
- if child.type == "variable_declaration":
- for sub in child.children:
- if sub.type == "variable_declarator":
- for leaf in sub.children:
- if leaf.type == "identifier":
- return node_text(leaf, src).strip()
- return None
-
-
-def _first_method_name(method_node: Node, src: str) -> str | None:
- for child in method_node.children:
- if child.type == "identifier":
- return node_text(child, src).strip()
- return None
-
-
-def _enclosing_type_name(node: Node, src: str) -> str | None:
- ancestor = node.parent
- while ancestor is not None:
- if ancestor.type in (
- "class_declaration",
- "struct_declaration",
- "record_declaration",
- ):
- name_node = ancestor.child_by_field_name("name")
- if name_node is not None:
- return node_text(name_node, src).strip()
- ancestor = ancestor.parent
- return None
-
-
-def _build_synthetic_symbol(
- *,
- name: str,
- kind: str,
- signature: str,
- start_line: int,
- end_line: int,
- file_info: FileInfo,
- parent_name: str | None,
-) -> Symbol:
- sym_id = (
- f"{file_info.path}::{parent_name}::{name}"
- if parent_name
- else f"{file_info.path}::{name}"
- )
- qualified = (
- f"{file_info.path}.{parent_name}.{name}"
- if parent_name
- else f"{file_info.path}.{name}"
- )
- return Symbol(
- id=sym_id,
- name=name,
- qualified_name=qualified,
- kind=kind, # type: ignore[arg-type]
- signature=signature,
- start_line=start_line,
- end_line=end_line,
- docstring=None,
- decorators=[],
- visibility="public",
- is_async=False,
- language=file_info.language,
- parent_name=parent_name,
- )
-
-
-_SYNTHETIC_EXTRACTORS: dict[str, Callable[[Node, str, FileInfo], list[Symbol]]] = {
- "csharp": _csharp_synthetic_symbols,
-}
-
-
-def extract_synthetic_symbols(
- root: Node, src: str, file_info: FileInfo
-) -> list[Symbol]:
- """Dispatch to the language-appropriate synthetic-symbol extractor.
-
- Returns an empty list for languages with no registered extractor.
- """
- fn = _SYNTHETIC_EXTRACTORS.get(file_info.language)
- if fn is None:
- return []
- return fn(root, src, file_info)
diff --git a/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/__init__.py b/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/__init__.py
new file mode 100644
index 000000000..1df820b3f
--- /dev/null
+++ b/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/__init__.py
@@ -0,0 +1,67 @@
+"""Per-language synthetic-symbol passes.
+
+Some frameworks rely on source generators or annotation processors that
+emit symbols at compile time. Those generated symbols don't appear in
+the AST of the user's source file, but they ARE referenced by name from
+other code (XAML bindings, Lombok-injected constructors, Java record
+accessors, Kotlin data-class ``copy``/``componentN``, MapStruct ``Impl``
+classes, ...). Without representing them in the symbol table, every
+binding to such a name looks like an unresolved reference and the
+user-visible symbol that "backs" it looks orphaned.
+
+This package dispatches per-language to source-specific providers. Each
+provider takes ``(root, src, file_info)`` and returns extra ``Symbol``
+records the parser appends to its main symbol list. Adding a new
+generator's support is one new module plus one entry in
+``_SYNTHETIC_EXTRACTORS``.
+
+Public surface — preserved for back-compat:
+ extract_synthetic_symbols(root, src, file_info) -> list[Symbol]
+"""
+
+from __future__ import annotations
+
+from collections.abc import Callable
+from typing import TYPE_CHECKING
+
+from ...models import FileInfo, Symbol
+from .csharp_mvvm import csharp_synthetic_symbols
+from .java_records import java_record_synthetic_symbols
+from .jvm_codegen import jvm_codegen_synthetic_symbols
+from .kotlin_jvm import kotlin_synthetic_symbols
+from .lombok import lombok_synthetic_symbols
+
+if TYPE_CHECKING:
+ from tree_sitter import Node
+
+
+# A "provider" returns the synthesised symbols for one file. Multiple
+# providers may run for a single language — the dispatcher concatenates
+# them and dedupes by symbol id at the parser level.
+_Provider = Callable[["Node", str, FileInfo], list[Symbol]]
+
+_SYNTHETIC_PROVIDERS: dict[str, list[_Provider]] = {
+ "csharp": [csharp_synthetic_symbols],
+ "java": [
+ lombok_synthetic_symbols,
+ java_record_synthetic_symbols,
+ jvm_codegen_synthetic_symbols,
+ ],
+ "kotlin": [kotlin_synthetic_symbols],
+}
+
+
+def extract_synthetic_symbols(
+ root: "Node", src: str, file_info: FileInfo
+) -> list[Symbol]:
+ """Dispatch to the language-appropriate synthetic-symbol providers.
+
+ Returns an empty list for languages with no registered provider.
+ """
+ providers = _SYNTHETIC_PROVIDERS.get(file_info.language)
+ if not providers:
+ return []
+ out: list[Symbol] = []
+ for provider in providers:
+ out.extend(provider(root, src, file_info))
+ return out
diff --git a/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/_helpers.py b/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/_helpers.py
new file mode 100644
index 000000000..9f0033e69
--- /dev/null
+++ b/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/_helpers.py
@@ -0,0 +1,75 @@
+"""Shared helpers for synthetic-symbol providers.
+
+Pure utilities used by ``csharp_mvvm``, ``lombok``, ``java_records``,
+``kotlin_jvm``, and other per-source modules in this package. No
+language-specific logic — anything that branches on attribute / source
+generator belongs in the source-specific module.
+"""
+
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+from ...models import FileInfo, Symbol
+from ..helpers import node_text
+
+if TYPE_CHECKING:
+ from tree_sitter import Node
+
+
+def build_synthetic_symbol(
+ *,
+ name: str,
+ kind: str,
+ signature: str,
+ start_line: int,
+ end_line: int,
+ file_info: FileInfo,
+ parent_name: str | None,
+ decorators: list[str] | None = None,
+) -> Symbol:
+ """Construct a ``Symbol`` instance for a generator-synthesised name.
+
+ The synthesised symbol carries no docstring (the user never wrote it)
+ and defaults to public visibility — generators emit public surfaces.
+ Symbol IDs follow the same ``<path>::[<parent>::]<name>`` shape the
+ real symbol pass uses, so the existing graph / dead-code passes
+ treat them identically.
+ """
+ sym_id = (
+ f"{file_info.path}::{parent_name}::{name}"
+ if parent_name
+ else f"{file_info.path}::{name}"
+ )
+ qualified = (
+ f"{file_info.path}.{parent_name}.{name}"
+ if parent_name
+ else f"{file_info.path}.{name}"
+ )
+ return Symbol(
+ id=sym_id,
+ name=name,
+ qualified_name=qualified,
+ kind=kind, # type: ignore[arg-type]
+ signature=signature,
+ start_line=start_line,
+ end_line=end_line,
+ docstring=None,
+ decorators=decorators or [],
+ visibility="public",
+ is_async=False,
+ language=file_info.language,
+ parent_name=parent_name,
+ )
+
+
+def enclosing_type_name(node: "Node", src: str, ancestor_types: frozenset[str]) -> str | None:
+ """Walk up to find the nearest type-defining ancestor and return its name."""
+ ancestor = node.parent
+ while ancestor is not None:
+ if ancestor.type in ancestor_types:
+ name_node = ancestor.child_by_field_name("name")
+ if name_node is not None:
+ return node_text(name_node, src).strip()
+ ancestor = ancestor.parent
+ return None
diff --git a/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/csharp_mvvm.py b/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/csharp_mvvm.py
new file mode 100644
index 000000000..c3873de65
--- /dev/null
+++ b/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/csharp_mvvm.py
@@ -0,0 +1,145 @@
+"""CommunityToolkit.Mvvm source-generator synthesis.
+
+ - ``[ObservableProperty] private string _name;`` → property ``Name``
+ - ``[RelayCommand] private void Save() { … }`` → command ``SaveCommand``
+
+Verbatim of the original ``synthetic_symbols.py`` C# pass — refactored
+into this per-source module behind the ``__init__.py`` façade. No
+behaviour change.
+"""
+
+from __future__ import annotations
+
+import re
+from typing import TYPE_CHECKING
+
+from ...models import FileInfo, Symbol
+from ..helpers import node_text
+from ._helpers import build_synthetic_symbol, enclosing_type_name
+
+if TYPE_CHECKING:
+ from tree_sitter import Node
+
+
+_OBSERVABLE_PROPERTY = "ObservableProperty"
+_RELAY_COMMAND = "RelayCommand"
+
+_FIELD_NAME_TO_PROP_RE = re.compile(r"^_?([A-Za-z])(.*)$")
+
+_CSHARP_TYPE_ANCESTORS = frozenset(
+ {"class_declaration", "struct_declaration", "record_declaration"}
+)
+
+
+def _pascal_from_field(field_name: str) -> str | None:
+ """Convert ``_name`` / ``m_name`` / ``name`` → ``Name``."""
+ stripped = field_name.lstrip("_")
+ if stripped.startswith("m_"):
+ stripped = stripped[2:]
+ match = _FIELD_NAME_TO_PROP_RE.match(stripped)
+ if not match:
+ return None
+ first, rest = match.groups()
+ return first.upper() + rest
+
+
+def _attribute_names(attr_list_node: "Node", src: str) -> set[str]:
+ names: set[str] = set()
+ for child in attr_list_node.children:
+ if child.type != "attribute":
+ continue
+ for sub in child.children:
+ if sub.type in ("identifier", "qualified_name"):
+ text = node_text(sub, src).strip()
+ names.add(text.split(".")[-1])
+ break
+ return names
+
+
+def _has_attribute(node: "Node", attr_name: str, src: str) -> bool:
+ for child in node.children:
+ if child.type == "attribute_list" and attr_name in _attribute_names(child, src):
+ return True
+ return False
+
+
+def _first_field_name(field_node: "Node", src: str) -> str | None:
+ for child in field_node.children:
+ if child.type == "variable_declaration":
+ for sub in child.children:
+ if sub.type == "variable_declarator":
+ for leaf in sub.children:
+ if leaf.type == "identifier":
+ return node_text(leaf, src).strip()
+ return None
+
+
+def _first_method_name(method_node: "Node", src: str) -> str | None:
+ for child in method_node.children:
+ if child.type == "identifier":
+ return node_text(child, src).strip()
+ return None
+
+
+def _maybe_observable_property(
+ field_node: "Node", src: str, file_info: FileInfo
+) -> Symbol | None:
+ if not _has_attribute(field_node, _OBSERVABLE_PROPERTY, src):
+ return None
+ field_name = _first_field_name(field_node, src)
+ if not field_name:
+ return None
+ prop_name = _pascal_from_field(field_name)
+ if not prop_name or prop_name == field_name:
+ return None
+ parent = enclosing_type_name(field_node, src, _CSHARP_TYPE_ANCESTORS)
+ return build_synthetic_symbol(
+ name=prop_name,
+ kind="variable",
+ signature=f"public T {prop_name} {{ get; set; }}",
+ start_line=field_node.start_point[0] + 1,
+ end_line=field_node.end_point[0] + 1,
+ file_info=file_info,
+ parent_name=parent,
+ )
+
+
+def _maybe_relay_command(
+ method_node: "Node", src: str, file_info: FileInfo
+) -> Symbol | None:
+ if not _has_attribute(method_node, _RELAY_COMMAND, src):
+ return None
+ method_name = _first_method_name(method_node, src)
+ if not method_name:
+ return None
+ command_name = f"{method_name}Command"
+ parent = enclosing_type_name(method_node, src, _CSHARP_TYPE_ANCESTORS)
+ return build_synthetic_symbol(
+ name=command_name,
+ kind="variable",
+ signature=f"public IRelayCommand {command_name} {{ get; }}",
+ start_line=method_node.start_point[0] + 1,
+ end_line=method_node.end_point[0] + 1,
+ file_info=file_info,
+ parent_name=parent,
+ )
+
+
+def csharp_synthetic_symbols(
+ root: "Node", src: str, file_info: FileInfo
+) -> list[Symbol]:
+ """Emit synthetic symbols for CommunityToolkit MVVM attributes."""
+ out: list[Symbol] = []
+ stack: list[Node] = [root]
+ while stack:
+ node = stack.pop()
+ if node.type == "field_declaration":
+ sym = _maybe_observable_property(node, src, file_info)
+ if sym is not None:
+ out.append(sym)
+ elif node.type == "method_declaration":
+ sym = _maybe_relay_command(node, src, file_info)
+ if sym is not None:
+ out.append(sym)
+ stack.extend(node.children)
+ return out
diff --git a/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/java_records.py b/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/java_records.py
new file mode 100644
index 000000000..f010732fb
--- /dev/null
+++ b/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/java_records.py
@@ -0,0 +1,114 @@
+"""Java record component-accessor synthesis.
+
+A ``record Foo(T1 a, T2 b) {}`` declaration automatically synthesises:
+ - a canonical constructor ``Foo(T1 a, T2 b)``
+ - one accessor per component: ``a()``, ``b()``
+ - ``equals(Object)``, ``hashCode()``, ``toString()``
+
+The parser already emits a Symbol for the record itself, but the
+component accessors and canonical constructor never appear in the AST —
+so calls to ``point.x()`` resolve to nothing and the components read as
+unused fields. This provider emits the missing names.
+"""
+
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+from ...models import FileInfo, Symbol
+from ..helpers import node_text
+from ._helpers import build_synthetic_symbol
+
+if TYPE_CHECKING:
+ from tree_sitter import Node
+
+
+def _record_components(record_node: "Node", src: str) -> list[tuple[str, str]]:
+ """Return [(name, type_text), ...] for each component of a record header."""
+ params = record_node.child_by_field_name("parameters")
+ if params is None:
+ for child in record_node.children:
+ if child.type == "formal_parameters":
+ params = child
+ break
+ if params is None:
+ return []
+ out: list[tuple[str, str]] = []
+ for child in params.children:
+ if child.type != "formal_parameter":
+ continue
+ type_text = ""
+ name: str | None = None
+ for sub in child.children:
+ if sub.type == "identifier" and name is None:
+ name = node_text(sub, src).strip()
+ elif sub.type not in ("modifiers", ",", "(", ")"):
+ if not type_text:
+ type_text = node_text(sub, src).strip()
+ if name:
+ out.append((name, type_text))
+ return out
+
+
+def java_record_synthetic_symbols(
+ root: "Node", src: str, file_info: FileInfo
+) -> list[Symbol]:
+ """Emit canonical constructor + accessors + equals/hashCode/toString."""
+ if "record" not in src:
+ return []
+
+ out: list[Symbol] = []
+ stack: list[Node] = [root]
+ while stack:
+ node = stack.pop()
+ stack.extend(node.children)
+ if node.type != "record_declaration":
+ continue
+ name_node = node.child_by_field_name("name")
+ if name_node is None:
+ continue
+ record_name = node_text(name_node, src).strip()
+ if not record_name:
+ continue
+ line = node.start_point[0] + 1
+ components = _record_components(node, src)
+
+ # Canonical constructor (same name as the record).
+ out.append(build_synthetic_symbol(
+ name=record_name, kind="function",
+ signature=f"public {record_name}("
+ + ", ".join(f"{t} {n}" for n, t in components)
+ + ")",
+ start_line=line, end_line=line,
+ file_info=file_info, parent_name=record_name,
+ ))
+
+ # Component accessors — same name as the component, zero args.
+ for comp_name, comp_type in components:
+ out.append(build_synthetic_symbol(
+ name=comp_name, kind="method",
+ signature=f"public {comp_type or 'Object'} {comp_name}()",
+ start_line=line, end_line=line,
+ file_info=file_info, parent_name=record_name,
+ ))
+
+ # Object-contract methods every record gets.
+ out.append(build_synthetic_symbol(
+ name="equals", kind="method",
+ signature="public boolean equals(Object)",
+ start_line=line, end_line=line,
+ file_info=file_info, parent_name=record_name,
+ ))
+ out.append(build_synthetic_symbol(
+ name="hashCode", kind="method",
+ signature="public int hashCode()",
+ start_line=line, end_line=line,
+ file_info=file_info, parent_name=record_name,
+ ))
+ out.append(build_synthetic_symbol(
+ name="toString", kind="method",
+ signature="public String toString()",
+ start_line=line, end_line=line,
+ file_info=file_info, parent_name=record_name,
+ ))
+ return out
diff --git a/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/jvm_codegen.py b/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/jvm_codegen.py
new file mode 100644
index 000000000..4fe3eb168
--- /dev/null
+++ b/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/jvm_codegen.py
@@ -0,0 +1,99 @@
+"""Annotation-processor generated symbol stubs for Java code generators
+that follow a predictable name-mangling pattern:
+
+ - MapStruct ``@Mapper interface XMapper {}`` → ``XMapperImpl``
+ - AutoValue ``@AutoValue class Foo {}`` → ``AutoValue_Foo``
+ - Immutables ``@Value.Immutable class Foo {}`` → ``ImmutableFoo``
+
+The actual generated classes live under ``target/generated-sources/`` or
+``build/generated/`` and are typically excluded from the index. By
+emitting the symbol stubs here we keep call sites like
+``Mappers.getMapper(Foo.class)`` (which resolves to ``FooImpl``),
+``AutoValue_Person.builder()``, and ``ImmutablePerson.of(...)``
+linked into the graph without parsing the generated source.
+"""
+
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+from ...models import FileInfo, Symbol
+from ..helpers import node_text
+from ._helpers import build_synthetic_symbol
+
+if TYPE_CHECKING:
+ from tree_sitter import Node
+
+
+def _has_marker_annotation(node: "Node", marker: str, src: str) -> bool:
+ """Walk the modifiers block looking for an annotation by bare name.
+
+ Handles ``@Mapper``, ``@AutoValue``, and ``@Value.Immutable`` —
+ the last is a nested annotation expressed as a single
+ ``identifier``-or-``scoped_identifier`` node.
+ """
+ for child in node.children:
+ if child.type != "modifiers":
+ continue
+ for sub in child.children:
+ if sub.type not in ("marker_annotation", "annotation"):
+ continue
+ for leaf in sub.children:
+ if leaf.type in ("identifier", "scoped_identifier"):
+ text = node_text(leaf, src).strip()
+ if marker in (text, text.split(".")[-1]):
+ return True
+ break
+ return False
+
+
+def jvm_codegen_synthetic_symbols(
+ root: "Node", src: str, file_info: FileInfo
+) -> list[Symbol]:
+ """Emit ``XMapperImpl`` / ``AutoValue_X`` / ``ImmutableX`` symbol stubs."""
+ # Cheap reject path — no annotations means no generated names.
+ if "@" not in src:
+ return []
+
+ out: list[Symbol] = []
+ stack: list[Node] = [root]
+ while stack:
+ node = stack.pop()
+ stack.extend(node.children)
+ if node.type not in ("class_declaration", "interface_declaration"):
+ continue
+ name_node = node.child_by_field_name("name")
+ if name_node is None:
+ continue
+ type_name = node_text(name_node, src).strip()
+ if not type_name:
+ continue
+ line = node.start_point[0] + 1
+
+ if _has_marker_annotation(node, "Mapper", src):
+ # ``XMapper`` → ``XMapperImpl`` (file-level, since the generated
+ # class lives in its own file).
+ impl_name = f"{type_name}Impl"
+ out.append(build_synthetic_symbol(
+ name=impl_name, kind="class",
+ signature=f"public class {impl_name} implements {type_name}",
+ start_line=line, end_line=line,
+ file_info=file_info, parent_name=None,
+ ))
+ if _has_marker_annotation(node, "AutoValue", src):
+ out.append(build_synthetic_symbol(
+ name=f"AutoValue_{type_name}", kind="class",
+ signature=f"public class AutoValue_{type_name} extends {type_name}",
+ start_line=line, end_line=line,
+ file_info=file_info, parent_name=None,
+ ))
+ if (_has_marker_annotation(node, "Immutable", src)
+ or _has_marker_annotation(node, "Value.Immutable", src)):
+ out.append(build_synthetic_symbol(
+ name=f"Immutable{type_name}", kind="class",
+ signature=f"public class Immutable{type_name} extends {type_name}",
+ start_line=line, end_line=line,
+ file_info=file_info, parent_name=None,
+ ))
+
+ return out
diff --git a/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/kotlin_jvm.py b/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/kotlin_jvm.py
new file mode 100644
index 000000000..f6af0e4a6
--- /dev/null
+++ b/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/kotlin_jvm.py
@@ -0,0 +1,166 @@
+"""Kotlin compile-time-synthesised symbols.
+
+The Kotlin compiler injects names that never appear in source:
+ - ``data class Point(val x: Int, val y: Int)``
+ → ``component1()``, ``component2()``, ``copy()``,
+ ``equals``, ``hashCode``, ``toString``
+ - ``enum class Color { RED, GREEN }``
+ → ``values()``, ``valueOf(String)``
+ - ``object Foo { ... }`` / ``companion object { ... }``
+ → static ``INSTANCE`` field at JVM level (Java code accesses it
+ as ``Foo.INSTANCE``); for companion objects, host-class methods
+ referenced through ``Foo.Companion`` resolve via the same name.
+
+This provider emits those names so cross-language code (Java ↔ Kotlin)
+and same-language destructuring / copy / valueOf calls resolve to real
+graph nodes.
+"""
+
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+from ...models import FileInfo, Symbol
+from ..helpers import node_text
+from ._helpers import build_synthetic_symbol
+
+if TYPE_CHECKING:
+ from tree_sitter import Node
+
+
+def _is_data_class(class_node: "Node") -> bool:
+ for child in class_node.children:
+ if child.type != "modifiers":
+ continue
+ for sub in child.children:
+ if sub.type != "class_modifier":
+ continue
+ for leaf in sub.children:
+ if leaf.type == "data":
+ return True
+ return False
+
+
+def _is_enum_class(class_node: "Node") -> bool:
+ for child in class_node.children:
+ if child.type != "modifiers":
+ continue
+ for sub in child.children:
+ if sub.type != "class_modifier":
+ continue
+ for leaf in sub.children:
+ if leaf.type == "enum":
+ return True
+ return False
+
+
+def _primary_components(class_node: "Node", src: str) -> list[tuple[str, str]]:
+ """Return [(name, type_text), ...] for primary-ctor parameters."""
+ out: list[tuple[str, str]] = []
+ for child in class_node.children:
+ if child.type != "primary_constructor":
+ continue
+ for sub in child.children:
+ if sub.type != "class_parameters":
+ continue
+ for param in sub.children:
+ if param.type != "class_parameter":
+ continue
+ name: str | None = None
+ type_text = ""
+ for leaf in param.children:
+ if leaf.type == "identifier" and name is None:
+ name = node_text(leaf, src).strip()
+ elif leaf.type in ("user_type", "nullable_type", "function_type"):
+ type_text = node_text(leaf, src).strip()
+ if name:
+ out.append((name, type_text))
+ return out
+
+
+def kotlin_synthetic_symbols(
+ root: "Node", src: str, file_info: FileInfo
+) -> list[Symbol]:
+ """Emit data-class / enum / object synthesised symbols."""
+ out: list[Symbol] = []
+ stack: list[Node] = [root]
+ while stack:
+ node = stack.pop()
+ stack.extend(node.children)
+
+ if node.type == "class_declaration":
+ name_node = node.child_by_field_name("name") or next(
+ (c for c in node.children if c.type == "identifier"),
+ None,
+ )
+ if name_node is None:
+ continue
+ class_name = node_text(name_node, src).strip()
+ if not class_name:
+ continue
+ line = node.start_point[0] + 1
+
+ if _is_data_class(node):
+ components = _primary_components(node, src)
+ for i, (cname, ctype) in enumerate(components, start=1):
+ out.append(build_synthetic_symbol(
+ name=f"component{i}", kind="method",
+ signature=f"public {ctype or 'Any'} component{i}()",
+ start_line=line, end_line=line,
+ file_info=file_info, parent_name=class_name,
+ ))
+ # copy(...) — same params as primary ctor.
+ copy_params = ", ".join(
+ f"{n}: {t or 'Any'}" for n, t in components
+ )
+ out.append(build_synthetic_symbol(
+ name="copy", kind="method",
+ signature=f"public {class_name} copy({copy_params})",
+ start_line=line, end_line=line,
+ file_info=file_info, parent_name=class_name,
+ ))
+ for nm in ("equals", "hashCode", "toString"):
+ out.append(build_synthetic_symbol(
+ name=nm, kind="method",
+ signature=f"public {nm}()",
+ start_line=line, end_line=line,
+ file_info=file_info, parent_name=class_name,
+ ))
+
+ if _is_enum_class(node):
+ out.append(build_synthetic_symbol(
+ name="values", kind="method",
+ signature=f"public static {class_name}[] values()",
+ start_line=line, end_line=line,
+ file_info=file_info, parent_name=class_name,
+ ))
+ out.append(build_synthetic_symbol(
+ name="valueOf", kind="method",
+ signature=f"public static {class_name} valueOf(String)",
+ start_line=line, end_line=line,
+ file_info=file_info, parent_name=class_name,
+ ))
+
+ elif node.type == "object_declaration":
+ name_node = node.child_by_field_name("name") or next(
+ (c for c in node.children if c.type == "identifier"),
+ None,
+ )
+ if name_node is None:
+ continue
+ object_name = node_text(name_node, src).strip()
+ if not object_name:
+ continue
+ line = node.start_point[0] + 1
+ # Kotlin compiles `object Foo { ... }` to a class with a
+ # static ``INSTANCE`` field. Java callers reach members via
+ # ``Foo.INSTANCE.method()``; this surfaces the field so the
+ # access is resolvable.
+ out.append(build_synthetic_symbol(
+ name="INSTANCE", kind="variable",
+ signature=f"public static final {object_name} INSTANCE",
+ start_line=line, end_line=line,
+ file_info=file_info, parent_name=object_name,
+ ))
+
+ return out
diff --git a/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/lombok.py b/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/lombok.py
new file mode 100644
index 000000000..eb751de9f
--- /dev/null
+++ b/packages/core/src/repowise/core/ingestion/extractors/synthetic_symbols/lombok.py
@@ -0,0 +1,350 @@
+"""Lombok annotation-processor symbol synthesis.
+
+Lombok rewrites the AST at compile time, materialising getters, setters,
+constructors, builders and a logger field from short annotation markers.
+Tree-sitter sees only the source the user wrote, so a Spring service
+declared with ``@RequiredArgsConstructor`` has all injected fields read
+as unused, every ``Foo.builder().bar(x).build()`` call against ``@Builder``
+is unresolved, and every ``log.info(...)`` against ``@Slf4j`` looks like
+an undefined identifier.
+
+This module emits the symbols the Lombok annotation processor would
+emit, driven entirely by the annotations the parser already captures
+in ``Symbol.decorators`` for the host type. No filesystem coupling and
+no second AST walk — Lombok only depends on the class's own annotations
+and its declared fields.
+
+Supported annotations:
+ Type-level:
+ @Getter / @Setter — public getX()/setX(T) per field
+ @ToString / @EqualsAndHashCode — toString, equals, hashCode, canEqual
+ @NoArgsConstructor — public Ctor()
+ @RequiredArgsConstructor — public Ctor(final-and-non-null fields)
+ @AllArgsConstructor — public Ctor(all fields)
+ @Data — @Getter+@Setter+@ToString+@EqualsAndHashCode+@RAC
+ @Value — @AllArgsConstructor+@Getter+@ToString+@EqualsAndHashCode
+ @Builder / @SuperBuilder — Foo.builder() static + inner FooBuilder
+ @Slf4j / @Log4j2 / @Log / @JBossLog
+ @XSlf4j / @CommonsLog / @Flogger — ``log`` field
+ @UtilityClass — private ctor + ``log`` not added
+ @With — withX(T) per field
+ Field-level:
+ @Getter / @Setter / @With — same shape, per single field
+
+Field-level annotations override type-level ones (more restrictive wins).
+"""
+
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+from ...models import FileInfo, Symbol
+from ..helpers import node_text
+from ._helpers import build_synthetic_symbol
+
+if TYPE_CHECKING:
+ from tree_sitter import Node
+
+
+# Annotations recognised on a class (or record / enum) declaration.
+_TYPE_ANNOTATIONS_OF_INTEREST = frozenset(
+ {
+ "Data", "Value",
+ "Getter", "Setter",
+ "ToString", "EqualsAndHashCode",
+ "NoArgsConstructor", "RequiredArgsConstructor", "AllArgsConstructor",
+ "Builder", "SuperBuilder",
+ "Slf4j", "Log4j2", "Log", "JBossLog",
+ "XSlf4j", "CommonsLog", "Flogger",
+ "UtilityClass",
+ "With",
+ }
+)
+
+# Field-level annotations override the type-level set for that one field.
+_FIELD_ANNOTATIONS_OF_INTEREST = frozenset(
+ {"Getter", "Setter", "With", "ToString.Exclude", "EqualsAndHashCode.Exclude"}
+)
+
+_TYPE_LOGGER_ANNOTATIONS = {
+ "Slf4j": "Logger",
+ "XSlf4j": "XLogger",
+ "Log4j2": "Logger",
+ "Log": "Logger",
+ "JBossLog": "Logger",
+ "CommonsLog": "Log",
+ "Flogger": "FluentLogger",
+}
+
+
+def _bare_annotation_names(modifiers_node: "Node", src: str) -> set[str]:
+ """Return the bare names of every annotation on a modifiers node.
+
+ ``@lombok.Data`` / ``@Data`` / ``@Data(staticConstructor="of")`` all
+ fold to ``"Data"``.
+ """
+ names: set[str] = set()
+ for child in modifiers_node.children:
+ if child.type not in ("marker_annotation", "annotation"):
+ continue
+ for sub in child.children:
+ if sub.type in ("identifier", "scoped_identifier"):
+ text = node_text(sub, src).strip()
+ names.add(text.split(".")[-1])
+ break
+ return names
+
+
+def _field_info(field_node: "Node", src: str) -> tuple[str, str, bool, set[str]] | None:
+ """Return (field_name, type_text, is_final, field_annotations) or None.
+
+ A single ``field_declaration`` can declare multiple variables
+ (``int x, y;``) — we return the first; callers iterate by walking
+ the AST themselves where it matters.
+ """
+ type_text = ""
+ is_final = False
+ field_annotations: set[str] = set()
+ name: str | None = None
+
+ for child in field_node.children:
+ if child.type == "modifiers":
+ for sub in child.children:
+ if sub.type == "final":
+ is_final = True
+ elif sub.type in ("marker_annotation", "annotation"):
+ for leaf in sub.children:
+ if leaf.type in ("identifier", "scoped_identifier"):
+ field_annotations.add(
+ node_text(leaf, src).strip().split(".")[-1]
+ )
+ break
+ elif child.type == "variable_declarator":
+ for leaf in child.children:
+ if leaf.type == "identifier" and name is None:
+ name = node_text(leaf, src).strip()
+ break
+ elif child.type not in (";", ","):
+ # Whatever this node is, it sits where the type goes —
+ # type_identifier / generic_type / scoped_type_identifier /
+ # array_type / annotated_type / integral_type / void_type /
+ # boolean_type / floating_point_type. Capture its text.
+ if not type_text:
+ type_text = node_text(child, src).strip()
+
+ if not name:
+ return None
+ return name, type_text, is_final, field_annotations
+
+
+def _class_fields(class_node: "Node", src: str) -> list[tuple[str, str, bool, set[str]]]:
+ """Return a list of (name, type_text, is_final, annotations) per declared field."""
+ fields: list[tuple[str, str, bool, set[str]]] = []
+ body = class_node.child_by_field_name("body")
+ if body is None:
+ for child in class_node.children:
+ if child.type in ("class_body", "interface_body", "record_body"):
+ body = child
+ break
+ if body is None:
+ return fields
+ for child in body.children:
+ if child.type != "field_declaration":
+ continue
+ info = _field_info(child, src)
+ if info is not None:
+ fields.append(info)
+ return fields
+
+
+def _pascal_case(name: str) -> str:
+ stripped = name.lstrip("_")
+ if not stripped:
+ return ""
+ return stripped[0].upper() + stripped[1:]
+
+
+def _getter_name(field_name: str, field_type: str) -> str:
+ """``boolean active`` → ``isActive``; otherwise ``getX``.
+
+ Lombok's actual rule is fancier (handles ``is`` prefixes, ``Boolean``
+ boxed) but this approximation captures the high-value cases.
+ """
+ pascal = _pascal_case(field_name)
+ if not pascal:
+ return ""
+ if field_type == "boolean":
+ return f"is{pascal}"
+ return f"get{pascal}"
+
+
+def _setter_name(field_name: str) -> str:
+ return f"set{_pascal_case(field_name)}"
+
+
+def _with_name(field_name: str) -> str:
+ return f"with{_pascal_case(field_name)}"
+
+
+def _add(out: list[Symbol], file_info: FileInfo, *, name: str, kind: str,
+ parent: str, line: int, signature: str) -> None:
+ if not name:
+ return
+ out.append(build_synthetic_symbol(
+ name=name,
+ kind=kind,
+ signature=signature,
+ start_line=line,
+ end_line=line,
+ file_info=file_info,
+ parent_name=parent,
+ ))
+
+
+def _emit_for_class(
+ class_node: "Node", src: str, file_info: FileInfo, out: list[Symbol]
+) -> None:
+ name_node = class_node.child_by_field_name("name")
+ if name_node is None:
+ return
+ class_name = node_text(name_node, src).strip()
+ if not class_name:
+ return
+ line = class_node.start_point[0] + 1
+
+ annotations: set[str] = set()
+ for child in class_node.children:
+ if child.type == "modifiers":
+ annotations |= _bare_annotation_names(child, src)
+ if not annotations & _TYPE_ANNOTATIONS_OF_INTEREST and not any(
+ a in _TYPE_LOGGER_ANNOTATIONS for a in annotations
+ ):
+ return
+
+ is_data = "Data" in annotations
+ is_value = "Value" in annotations
+ has_getter = "Getter" in annotations or is_data or is_value
+ has_setter = "Setter" in annotations or is_data # @Value is immutable — no setters
+ has_toString = "ToString" in annotations or is_data or is_value
+ has_eq = "EqualsAndHashCode" in annotations or is_data or is_value
+ has_rac = "RequiredArgsConstructor" in annotations or is_data
+ has_aac = "AllArgsConstructor" in annotations or is_value
+ has_noac = "NoArgsConstructor" in annotations
+ has_builder = "Builder" in annotations or "SuperBuilder" in annotations
+ has_with = "With" in annotations
+ is_utility = "UtilityClass" in annotations
+
+ fields = _class_fields(class_node, src)
+
+ # Per-field getters/setters/withers.
+ for field_name, field_type, is_final, field_annotations in fields:
+ field_get = "Getter" in field_annotations or has_getter
+ field_set = "Setter" in field_annotations or has_setter
+ field_with = "With" in field_annotations or has_with
+ if field_get:
+ _add(out, file_info, name=_getter_name(field_name, field_type),
+ kind="method", parent=class_name, line=line,
+ signature=f"public {field_type or 'Object'} {_getter_name(field_name, field_type)}()")
+ if field_set and not is_value:
+ _add(out, file_info, name=_setter_name(field_name),
+ kind="method", parent=class_name, line=line,
+ signature=f"public void {_setter_name(field_name)}({field_type or 'Object'})")
+ if field_with:
+ _add(out, file_info, name=_with_name(field_name),
+ kind="method", parent=class_name, line=line,
+ signature=f"public {class_name} {_with_name(field_name)}({field_type or 'Object'})")
+
+ if has_toString:
+ _add(out, file_info, name="toString", kind="method",
+ parent=class_name, line=line,
+ signature="public String toString()")
+ if has_eq:
+ _add(out, file_info, name="equals", kind="method",
+ parent=class_name, line=line,
+ signature="public boolean equals(Object)")
+ _add(out, file_info, name="hashCode", kind="method",
+ parent=class_name, line=line,
+ signature="public int hashCode()")
+ _add(out, file_info, name="canEqual", kind="method",
+ parent=class_name, line=line,
+ signature="protected boolean canEqual(Object)")
+
+ if has_rac:
+ # @RequiredArgsConstructor: final + @NonNull fields. We don't know
+ # @NonNull from the source without parsing all annotations, so use
+ # `is_final` as the proxy — covers the dominant Spring DI case
+ # of ``private final Service service``.
+ required = [
+ (n, t) for (n, t, fin, _) in fields if fin
+ ]
+ _add(out, file_info, name=class_name, kind="function",
+ parent=class_name, line=line,
+ signature=f"public {class_name}({', '.join(f'{t} {n}' for n, t in required)})")
+ if has_aac:
+ all_params = [(n, t) for (n, t, _, _) in fields]
+ _add(out, file_info, name=class_name, kind="function",
+ parent=class_name, line=line,
+ signature=f"public {class_name}({', '.join(f'{t} {n}' for n, t in all_params)})")
+ if has_noac:
+ _add(out, file_info, name=class_name, kind="function",
+ parent=class_name, line=line,
+ signature=f"public {class_name}()")
+
+ if has_builder:
+ builder_class = f"{class_name}Builder"
+ # The builder class itself
+ out.append(build_synthetic_symbol(
+ name=builder_class, kind="class",
+ signature=f"public static class {builder_class}",
+ start_line=line, end_line=line,
+ file_info=file_info, parent_name=class_name,
+ ))
+ # Static factory on the host class
+ _add(out, file_info, name="builder", kind="method",
+ parent=class_name, line=line,
+ signature=f"public static {builder_class} builder()")
+ # Builder-per-field methods + build()
+ for field_name, field_type, _is_final, _ann in fields:
+ _add(out, file_info, name=field_name, kind="method",
+ parent=builder_class, line=line,
+ signature=f"public {builder_class} {field_name}({field_type or 'Object'})")
+ _add(out, file_info, name="build", kind="method",
+ parent=builder_class, line=line,
+ signature=f"public {class_name} build()")
+ _add(out, file_info, name="toString", kind="method",
+ parent=builder_class, line=line,
+ signature="public String toString()")
+
+ if is_utility:
+ # Lombok turns the class into a final utility — emit a private
+ # default constructor so the class is "constructed" somewhere.
+ _add(out, file_info, name=class_name, kind="function",
+ parent=class_name, line=line,
+ signature=f"private {class_name}()")
+
+ # Logger field — only one logger annotation per class is valid.
+ for ann, logger_type in _TYPE_LOGGER_ANNOTATIONS.items():
+ if ann in annotations:
+ _add(out, file_info, name="log", kind="variable",
+ parent=class_name, line=line,
+ signature=f"private static final {logger_type} log")
+ break
+
+
+def lombok_synthetic_symbols(
+ root: "Node", src: str, file_info: FileInfo
+) -> list[Symbol]:
+ """Emit synthetic symbols for Lombok-annotated Java classes."""
+ # Cheap reject path: if the source doesn't even mention `@`, there
+ # can't be any annotations.
+ if "@" not in src:
+ return []
+
+ out: list[Symbol] = []
+ stack: list[Node] = [root]
+ while stack:
+ node = stack.pop()
+ if node.type == "class_declaration":
+ _emit_for_class(node, src, file_info, out)
+ stack.extend(node.children)
+ return out
diff --git a/packages/core/src/repowise/core/ingestion/parser_helpers.py b/packages/core/src/repowise/core/ingestion/parser_helpers.py
index 7210ac188..c092af027 100644
--- a/packages/core/src/repowise/core/ingestion/parser_helpers.py
+++ b/packages/core/src/repowise/core/ingestion/parser_helpers.py
@@ -196,6 +196,21 @@ _PARAM_ORIGIN_BY_ANCESTOR: dict[str, str] = {
"extends_clause": "extends",
"extends_type_clause": "extends",
"implements_clause": "implements",
+ # JVM (Java + Kotlin) type positions. Note: ``parameter`` is NOT
+ # mapped here because tree-sitter-c-sharp also uses ``parameter``
+ # for ctor params and adding it would override C#'s walk to the
+ # enclosing ``constructor_declaration``. Kotlin function-parameter
+ # origin therefore falls through to ``function_declaration`` →
+ # "return_type" (imprecise but harmless — origin is provenance only).
+ "formal_parameter": "param_type",
+ "object_creation_expression": "composite_literal",
+ "local_variable_declaration": "field_type",
+ "superclass": "extends",
+ "super_interfaces": "implements",
+ "type_list": "implements",
+ "class_parameter": "ctor_param", # Kotlin primary-ctor parameter
+ "variable_declaration": "field_type", # Kotlin property declaration
+ "delegation_specifier": "extends", # Kotlin class : Bar()
}
@@ -626,6 +641,225 @@ def _ts_head_type_identifier(type_node: Node, src: str) -> str | None:
return text
+# ---------------------------------------------------------------------------
+# Java type-reference head extraction
+# ---------------------------------------------------------------------------
+
+# Primitives + ubiquitous JDK types that never resolve to a user-defined
+# Java/Kotlin class in the workspace. Stripping them at extraction time
+# avoids polluting the resolver with hopeless lookups. The list errs on
+# the side of inclusion: a user class colliding with one of these names
+# still surfaces through the value-import path, just not through the
+# type-ref path.
+_JAVA_BUILTIN_TYPES: frozenset[str] = frozenset(
+ {
+ # Java primitives + builtin type nodes
+ "boolean", "byte", "short", "int", "long", "float", "double",
+ "char", "void", "var",
+ # java.lang (auto-imported)
+ "Object", "String", "Class", "Enum", "Record",
+ "Integer", "Long", "Double", "Float", "Boolean", "Character",
+ "Byte", "Short", "Number", "Void",
+ "Thread", "Runnable", "Runtime", "Process", "ProcessBuilder",
+ "Throwable", "Exception", "RuntimeException", "Error",
+ "IllegalArgumentException", "IllegalStateException",
+ "NullPointerException", "UnsupportedOperationException",
+ "IndexOutOfBoundsException", "ClassCastException",
+ "ArithmeticException", "SecurityException", "ClassNotFoundException",
+ "InterruptedException", "CloneNotSupportedException",
+ "StringBuilder", "StringBuffer",
+ "Comparable", "Iterable", "AutoCloseable", "Cloneable",
+ "Override", "Deprecated", "SuppressWarnings",
+ "FunctionalInterface", "SafeVarargs",
+ "Math", "System",
+ # java.util ubiquitous containers (almost always external when used
+ # as a type position; the actual element type is captured separately
+ # by the same query via the type_arguments inner capture).
+ "List", "ArrayList", "LinkedList",
+ "Map", "HashMap", "LinkedHashMap", "TreeMap", "ConcurrentHashMap",
+ "Set", "HashSet", "LinkedHashSet", "TreeSet",
+ "Collection", "Collections", "Iterator", "Optional",
+ "Queue", "Deque", "ArrayDeque", "Stack",
+ # java.util.function
+ "Function", "BiFunction", "Consumer", "BiConsumer", "Supplier",
+ "Predicate", "BiPredicate", "UnaryOperator", "BinaryOperator",
+ # java.util.concurrent ubiquitous
+ "Future", "CompletableFuture", "Executor", "ExecutorService",
+ "CountDownLatch", "Semaphore", "AtomicBoolean", "AtomicInteger",
+ "AtomicLong", "AtomicReference",
+ # java.time
+ "Instant", "Duration", "LocalDate", "LocalTime", "LocalDateTime",
+ "ZonedDateTime", "OffsetDateTime", "Period", "ZoneId",
+ # java.io
+ "File", "InputStream", "OutputStream", "Reader", "Writer",
+ "IOException", "Serializable",
+ }
+)
+
+
+def _java_head_type_identifier(type_node: Node, src: str) -> str | None:
+ """Return the head type identifier of a Java type expression, or None.
+
+ Examples:
+ ``Bar`` → "Bar"
+ ``java.util.List<Foo>`` → "List" → filtered (builtin)
+ ``com.x.y.Z`` → "Z"
+ ``Foo.Bar`` → "Bar" (inner type)
+ ``Foo[]`` → "Foo"
+ ``int`` / ``void`` / ``long`` → None
+ ``T`` → None (generic parameter)
+ """
+ node: Node | None = type_node
+ text = ""
+ for _ in range(8):
+ if node is None:
+ return None
+ kind = node.type
+ if kind == "type_identifier":
+ text = _node_text(node, src)
+ break
+ if kind in (
+ "void_type", "integral_type", "floating_point_type",
+ "boolean_type",
+ ):
+ return None
+ if kind == "scoped_type_identifier":
+ # ``com.x.y.Z`` / ``Foo.Bar`` — take the rightmost type_identifier
+ inner_ids = [c for c in node.children if c.type == "type_identifier"]
+ if not inner_ids:
+ return None
+ text = _node_text(inner_ids[-1], src)
+ break
+ if kind == "generic_type":
+ # ``Foo<T>`` — descend to the bare name; generic args are
+ # captured separately by their own type_arguments inner captures.
+ inner = next(
+ (c for c in node.named_children
+ if c.type in ("type_identifier", "scoped_type_identifier")),
+ None,
+ )
+ node = inner
+ continue
+ if kind == "array_type":
+ # ``Foo[]`` — element child has no field name; take first named.
+ inner = next(iter(node.named_children), None)
+ node = inner
+ continue
+ if kind == "annotated_type":
+ # ``@NonNull Foo`` — last named child is the type.
+ node = next(
+ (c for c in reversed(node.named_children)
+ if c.type not in ("annotation", "marker_annotation")),
+ None,
+ )
+ continue
+ # Anything else (wildcard, type_parameter, ...) — descend.
+ node = next(iter(node.named_children), None)
+ else:
+ return None
+
+ if not text or (not text[0].isalpha() and text[0] != "_"):
+ return None
+ if text in _JAVA_BUILTIN_TYPES:
+ return None
+ # Single-uppercase-letter heads are overwhelmingly generic type params.
+ if len(text) == 1 and text.isupper():
+ return None
+ return text
+
+
+# ---------------------------------------------------------------------------
+# Kotlin type-reference head extraction
+# ---------------------------------------------------------------------------
+
+_KOTLIN_BUILTIN_TYPES: frozenset[str] = frozenset(
+ {
+ # Kotlin primitives (kotlin package, auto-imported)
+ "Boolean", "Byte", "Short", "Int", "Long", "Float", "Double", "Char",
+ "String", "Unit", "Nothing", "Any", "Number",
+ "Array", "IntArray", "LongArray", "ByteArray", "ShortArray",
+ "FloatArray", "DoubleArray", "CharArray", "BooleanArray",
+ "List", "MutableList", "ArrayList",
+ "Map", "MutableMap", "HashMap", "LinkedHashMap",
+ "Set", "MutableSet", "HashSet", "LinkedHashSet",
+ "Collection", "MutableCollection",
+ "Iterable", "MutableIterable", "Iterator", "MutableIterator",
+ "Sequence", "Pair", "Triple", "Result",
+ "Comparable", "Comparator",
+ "Throwable", "Exception", "RuntimeException", "Error",
+ "IllegalArgumentException", "IllegalStateException",
+ "NullPointerException", "UnsupportedOperationException",
+ "IndexOutOfBoundsException", "ClassCastException",
+ "Lazy", "Regex", "Range", "IntRange", "LongRange", "CharRange",
+ "Enum", "Annotation",
+ # kotlin.io / kotlin.text / kotlin.collections ubiquitous
+ "Reader", "Writer", "BufferedReader", "BufferedWriter",
+ # Coroutines + JVM common
+ "Object", "Function", "Runnable", "Class", "Void",
+ }
+)
+
+
+def _kotlin_head_type_identifier(type_node: Node, src: str) -> str | None:
+ """Return the head identifier of a Kotlin type expression, or None.
+
+ Examples:
+ ``Bar`` → "Bar"
+ ``Foo?`` → "Foo" (nullable_type unwrapped)
+ ``List<Foo>`` → "List" → filtered (builtin)
+ ``com.x.Foo`` → "Foo" (dotted user_type)
+ ``Foo.Bar`` → "Bar"
+ ``() -> Foo`` → None (function_type — skipped)
+ ``Unit`` / ``Any`` / ``String`` → None (builtin)
+ """
+ node: Node | None = type_node
+ text = ""
+ for _ in range(8):
+ if node is None:
+ return None
+ kind = node.type
+ if kind == "user_type":
+ # ``Foo`` / ``Foo<...>`` / ``ns.Foo``.
+ # Children: identifier, type_arguments, possibly more dotted parts.
+ # Rightmost identifier is the head; type_arguments contains the
+ # generic args (captured separately by their own type-ref).
+ inner_ids = [c for c in node.children if c.type == "identifier"]
+ if not inner_ids:
+ return None
+ text = _node_text(inner_ids[-1], src)
+ break
+ if kind == "identifier":
+ text = _node_text(node, src)
+ break
+ if kind == "nullable_type":
+ # Unwrap ``Foo?`` to the underlying user_type.
+ inner = next(iter(node.named_children), None)
+ node = inner
+ continue
+ if kind in ("function_type", "parenthesized_type"):
+ # () -> Foo, (() -> Foo) — leaf type names are not captured.
+ return None
+ if kind == "type_reference":
+ node = next(iter(node.named_children), None)
+ continue
+ if kind == "type_projection":
+ # `<out Foo>` / `<in Foo>` / `<Foo>` — last named child is the type.
+ node = next(iter(node.named_children), None)
+ continue
+ # Anything else — descend.
+ node = next(iter(node.named_children), None)
+ else:
+ return None
+
+ if not text or (not text[0].isalpha() and text[0] != "_"):
+ return None
+ if text in _KOTLIN_BUILTIN_TYPES:
+ return None
+ if len(text) == 1 and text.isupper():
+ return None
+ return text
+
+
# Per-language head-identifier extractor for ``@param.type`` captures.
# Defaults to the C#-shaped extractor; languages with a differently-shaped
# type grammar register their own here.
@@ -635,6 +869,8 @@ TYPE_HEAD_EXTRACTORS: dict[str, "Callable[[Node, str], str | None]"] = {
"cpp": _c_head_type_identifier,
"typescript": _ts_head_type_identifier,
"javascript": _ts_head_type_identifier,
+ "java": _java_head_type_identifier,
+ "kotlin": _kotlin_head_type_identifier,
}
diff --git a/packages/core/src/repowise/core/ingestion/queries/java.scm b/packages/core/src/repowise/core/ingestion/queries/java.scm
index 1b07b97b5..5c604fe7b 100644
--- a/packages/core/src/repowise/core/ingestion/queries/java.scm
+++ b/packages/core/src/repowise/core/ingestion/queries/java.scm
@@ -92,3 +92,51 @@
type: (type_identifier) @call.target
arguments: (argument_list) @call.arguments
) @call.site
+
+; Method reference: Foo::bar — treat as a use of Foo.bar so the referenced
+; method is not flagged unused. The argument list is empty (no @call.arguments).
+(method_reference
+ . (identifier) @call.receiver
+ (identifier) @call.target
+) @call.site
+
+; ---------------------------------------------------------------------------
+; Type references — drive file-level ``type_use`` edges
+; ---------------------------------------------------------------------------
+; Java buries a large share of its dependency surface in type positions
+; that carry no import statement: a constructor or method parameter of an
+; injected service type, a field of a sibling-package class, the return
+; type of a factory, the element type of ``new Foo()``. The single
+; ``@param.type`` capture is reused across languages
+; (see parser._extract_type_refs); the Java head extractor in
+; parser_helpers.py unwraps ``T[]`` / ``Foo<...>`` / ``ns.Foo`` / annotated
+; types and filters primitives plus the most ubiquitous ``java.lang`` /
+; ``java.util`` / ``java.util.function`` builtins.
+
+; Constructor / method / lambda formal parameters
+(formal_parameter type: (_) @param.type)
+
+; Field declarations (instance + static)
+(field_declaration type: (_) @param.type)
+
+; Method return types
+(method_declaration type: (_) @param.type)
+
+; Constructor invocation type: ``new Foo<...>(args)``
+(object_creation_expression type: (_) @param.type)
+
+; Local variable types — rescues Spring-style ``Foo foo = svc.lookup();``
+(local_variable_declaration type: (_) @param.type)
+
+; Heritage clauses — emit file-level ``type_use`` edges that complement
+; the symbol-level extends/implements edges the heritage extractor
+; produces. A class that imports an interface only to implement it
+; counts as a consumer of the interface's file for unused-export
+; purposes.
+(superclass (_) @param.type)
+(super_interfaces (type_list (_) @param.type))
+
+; Generic type arguments inside any of the above — without this an
+; ``Optional<UserPreferences>`` field would only register ``Optional``
+; (a builtin) and never the user type ``UserPreferences``.
+(type_arguments (_) @param.type)
diff --git a/packages/core/src/repowise/core/ingestion/queries/kotlin.scm b/packages/core/src/repowise/core/ingestion/queries/kotlin.scm
index c54e5e223..fc1f00833 100644
--- a/packages/core/src/repowise/core/ingestion/queries/kotlin.scm
+++ b/packages/core/src/repowise/core/ingestion/queries/kotlin.scm
@@ -69,3 +69,39 @@
)
(value_arguments) @call.arguments
) @call.site
+
+; ---------------------------------------------------------------------------
+; Type references — drive file-level ``type_use`` edges
+; ---------------------------------------------------------------------------
+; Kotlin types appear in primary-ctor positions (``class Foo(val x: Bar)``),
+; function parameter / return positions, and property declarations — none
+; of which carry an import statement of their own. The single
+; ``@param.type`` capture is reused across languages
+; (see parser._extract_type_refs); the Kotlin head extractor in
+; parser_helpers.py unwraps ``Foo?`` / ``List<Foo>`` / dotted ``ns.Foo`` and
+; filters the kotlin-stdlib ubiquitous types.
+
+; Function parameter: fun f(x: Bar) — `(user_type)` and `(nullable_type)`
+; cover Foo and Foo?.
+(parameter (user_type) @param.type)
+(parameter (nullable_type) @param.type)
+
+; Primary-constructor parameter: class Foo(val b: Bar, c: Baz?)
+(class_parameter (user_type) @param.type)
+(class_parameter (nullable_type) @param.type)
+
+; Property type annotation: val p: Bar = TODO()
+(variable_declaration (user_type) @param.type)
+(variable_declaration (nullable_type) @param.type)
+
+; Function / property return type
+(function_declaration (user_type) @param.type)
+(function_declaration (nullable_type) @param.type)
+
+; Class heritage / interface implementation: class Foo : Bar, IBaz
+(delegation_specifier (user_type) @param.type)
+
+; Generic type arguments — inside ``Map<String, Foo>`` the inner
+; ``user_type`` for Foo is wrapped in ``type_projection``.
+(type_projection (user_type) @param.type)
+(type_projection (nullable_type) @param.type)
diff --git a/packages/core/src/repowise/core/ingestion/resolvers/jvm_workspace.py b/packages/core/src/repowise/core/ingestion/resolvers/jvm_workspace.py
index d74d2b2a8..b4d91f2d5 100644
--- a/packages/core/src/repowise/core/ingestion/resolvers/jvm_workspace.py
+++ b/packages/core/src/repowise/core/ingestion/resolvers/jvm_workspace.py
@@ -169,6 +169,37 @@ def _scan_jvm_file(abs_path: str) -> tuple[str, tuple[str, ...]]:
return package, tuple(types)
+_JPMS_PROVIDES_RE = re.compile(
+ r"provides\s+([\w.]+)\s+with\s+([\w.,\s]+);",
+ re.MULTILINE,
+)
+
+
+def _scan_jpms_provides(repo_path: Path) -> dict[str, tuple[str, ...]]:
+ """Scan ``module-info.java`` files for ``provides X with Y, Z`` directives.
+
+ Returns a mapping iface_fqn → impl_fqns identical in shape to
+ ``_scan_meta_inf_services``, so the two sources merge cleanly. Cheap
+ regex scan — the module-info syntax is restrictive enough that a
+ real parser is unnecessary, and avoiding the AST round-trip keeps
+ the warmup fast.
+ """
+ out: dict[str, list[str]] = {}
+ for mi in repo_path.rglob("module-info.java"):
+ if not mi.is_file():
+ continue
+ try:
+ text = mi.read_text(encoding="utf-8", errors="ignore")
+ except OSError:
+ continue
+ for m in _JPMS_PROVIDES_RE.finditer(text):
+ iface = m.group(1).strip()
+ impls = [s.strip() for s in m.group(2).split(",") if s.strip()]
+ if iface and impls:
+ out.setdefault(iface, []).extend(impls)
+ return {k: tuple(v) for k, v in out.items()}
+
+
def _scan_meta_inf_services(repo_path: Path) -> dict[str, tuple[str, ...]]:
"""Scan META-INF/services/ directories for SPI declarations."""
services: dict[str, list[str]] = {}
@@ -301,9 +332,16 @@ def build_jvm_workspace_index(ctx: "ResolverContext") -> JvmWorkspaceIndex:
exported_top_level=exported,
)
- # Scan META-INF resources (cheap glob, O(matching files))
+ # Scan META-INF resources + JPMS module-info.java provides directives
+ # (cheap glob, O(matching files)). Both populate ``services``; later
+ # phases treat any FQN listed there as reachable.
try:
- index.services = _scan_meta_inf_services(repo_path)
+ services = _scan_meta_inf_services(repo_path)
+ jpms = _scan_jpms_provides(repo_path)
+ merged: dict[str, list[str]] = {k: list(v) for k, v in services.items()}
+ for iface, impls in jpms.items():
+ merged.setdefault(iface, []).extend(impls)
+ index.services = {k: tuple(v) for k, v in merged.items()}
except Exception:
pass
try:
diff --git a/packages/core/src/repowise/core/ingestion/type_ref_resolution.py b/packages/core/src/repowise/core/ingestion/type_ref_resolution.py
index 718a2f6f5..efe95d974 100644
--- a/packages/core/src/repowise/core/ingestion/type_ref_resolution.py
+++ b/packages/core/src/repowise/core/ingestion/type_ref_resolution.py
@@ -474,6 +474,94 @@ def _find_ts_type_in_stem_map(
return None
+# ---------------------------------------------------------------------------
+# Strategy: Java / Kotlin (shared JVM workspace)
+# ---------------------------------------------------------------------------
+
+def _resolve_jvm_type_refs(
+ parsed: ParsedFile,
+ ctx: "ResolverContext",
+ graph: "nx.DiGraph",
+) -> int:
+ """Resolve Java / Kotlin ``@param.type`` captures via ``JvmWorkspaceIndex``.
+
+ JVM resolution order — mirrors how ``javac`` / ``kotlinc`` resolve a
+ bare type name in a source file:
+
+ 1. Same-package siblings — both ``.java`` and ``.kt`` files in
+ the package directory (Java + Kotlin co-located).
+ 2. Explicit imports (``import com.foo.Bar`` resolves to that file
+ via the workspace's FQN map; wildcard ``import com.foo.*`` /
+ ``import static com.foo.Bar.*`` fan out to every file in the
+ package; both are already attached to the file's ``Import``
+ records by the per-language resolver).
+ 3. ``java.lang`` builtins are filtered at extraction time by the
+ per-language head extractor — they never reach this code.
+
+ The candidate file set is collected once and then scanned for each
+ type reference, mirroring the Go strategy. Edges are emitted at
+ file granularity with the standard ``type_use`` confidence so the
+ unused-export pass sees field/param/return-only types as live.
+ """
+ if not parsed.type_refs:
+ return 0
+
+ from .resolvers.jvm_workspace import get_or_build_jvm_index
+
+ index = get_or_build_jvm_index(ctx)
+ from_path = parsed.file_info.path
+
+ candidates: set[str] = set()
+ own_pkg = index.package_for_file(from_path)
+ if own_pkg:
+ pkg = index.packages.get(own_pkg)
+ if pkg is not None:
+ candidates.update(pkg.files)
+ for imp in parsed.imports:
+ resolved = imp.resolved_file
+ if resolved and not resolved.startswith("external:"):
+ candidates.add(resolved)
+ candidates.discard(from_path)
+ if not candidates:
+ return 0
+
+ emitted = 0
+ seen_targets: set[tuple[str, str]] = set()
+ for ref in parsed.type_refs:
+ name = ref.type_name
+ if not name:
+ continue
+ target = _find_jvm_type_file(name, candidates, graph)
+ if target is None or target == from_path:
+ continue
+ if (name, target) in seen_targets:
+ continue
+ seen_targets.add((name, target))
+ if not graph.has_node(target):
+ continue
+ _add_or_merge_type_use_edge(
+ graph, src=from_path, dst=target, type_name=name, origin=ref.origin
+ )
+ emitted += 1
+ return emitted
+
+
+def _find_jvm_type_file(
+ type_name: str,
+ candidate_files: set[str],
+ graph: "nx.DiGraph",
+) -> str | None:
+ """Return a candidate file that defines a top-level type named *type_name*."""
+ for cand in candidate_files:
+ if not graph.has_node(cand):
+ continue
+ for succ in graph.successors(cand):
+ nd = graph.nodes.get(succ, {})
+ if nd.get("node_type") == "symbol" and nd.get("name") == type_name:
+ return cand
+ return None
+
+
# ---------------------------------------------------------------------------
# Strategy registry
# ---------------------------------------------------------------------------
@@ -491,6 +579,8 @@ _STRATEGIES: dict[str, Strategy] = {
"cpp": _resolve_c_type_refs,
"typescript": _resolve_ts_type_refs,
"javascript": _resolve_ts_type_refs,
+ "java": _resolve_jvm_type_refs,
+ "kotlin": _resolve_jvm_type_refs,
}
diff --git a/tests/unit/ingestion/test_jvm_calls.py b/tests/unit/ingestion/test_jvm_calls.py
new file mode 100644
index 000000000..566c2d457
--- /dev/null
+++ b/tests/unit/ingestion/test_jvm_calls.py
@@ -0,0 +1,155 @@
+"""Unit tests for JVM call resolution — companion objects, object singletons,
+Java method references."""
+
+from __future__ import annotations
+
+from datetime import datetime
+from pathlib import Path
+
+import networkx as nx
+
+from repowise.core.ingestion.call_resolver import CallResolver
+from repowise.core.ingestion.models import FileInfo, ParsedFile
+from repowise.core.ingestion.parser import parse_file
+
+
+def _file_info(rel: str, abs_: Path, lang: str) -> FileInfo:
+ return FileInfo(
+ path=rel,
+ abs_path=str(abs_),
+ language=lang, # type: ignore[arg-type]
+ size_bytes=abs_.stat().st_size,
+ git_hash="",
+ last_modified=datetime.now(),
+ is_test=False,
+ is_config=False,
+ is_api_contract=False,
+ is_entry_point=False,
+ )
+
+
+def _parse_all(tmp_path: Path, files: dict[str, tuple[str, str]]) -> dict[str, ParsedFile]:
+ out: dict[str, ParsedFile] = {}
+ for rel, (lang, content) in files.items():
+ abs_ = tmp_path / rel
+ abs_.parent.mkdir(parents=True, exist_ok=True)
+ abs_.write_text(content)
+ fi = _file_info(rel, abs_, lang)
+ out[rel] = parse_file(fi, content.encode("utf-8"))
+ return out
+
+
+def _resolve_calls(
+ parsed: dict[str, ParsedFile],
+ tmp_path: Path,
+ import_targets: dict[str, set[str]] | None = None,
+):
+ resolver = CallResolver(
+ parsed,
+ import_targets or {p: set() for p in parsed},
+ repo_path=str(tmp_path),
+ )
+ edges: list[tuple[str, str, float]] = []
+ for path, pf in parsed.items():
+ for rc in resolver.resolve_file(path, pf.calls):
+ edges.append((rc.caller_id, rc.callee_id, rc.confidence))
+ return edges
+
+
+class TestKotlinCompanionAndObject:
+ def test_companion_object_method_call_resolves(self, tmp_path: Path) -> None:
+ files = {
+ "src/main/kotlin/com/foo/Caller.kt": (
+ "kotlin",
+ "package com.foo\n"
+ "class Caller {\n"
+ " fun run() { Foo.build() }\n"
+ "}\n",
+ ),
+ "src/main/kotlin/com/foo/Foo.kt": (
+ "kotlin",
+ "package com.foo\n"
+ "class Foo {\n"
+ " val x = 1\n"
+ " companion object {\n"
+ " fun build(): Int = 1\n"
+ " }\n"
+ "}\n",
+ ),
+ }
+ parsed = _parse_all(tmp_path, files)
+ edges = _resolve_calls(parsed, tmp_path)
+ assert any(
+ "Caller.kt::Caller::run" in u
+ and "Foo.kt::Foo::build" in v
+ for u, v, _ in edges
+ ), edges
+
+ def test_object_singleton_method_call_resolves(self, tmp_path: Path) -> None:
+ files = {
+ "src/main/kotlin/com/foo/Caller.kt": (
+ "kotlin",
+ "package com.foo\n"
+ "class Caller {\n"
+ " fun run() { Single.do_it() }\n"
+ "}\n",
+ ),
+ "src/main/kotlin/com/foo/Single.kt": (
+ "kotlin",
+ "package com.foo\n"
+ "object Single { fun do_it(): Int = 1 }\n",
+ ),
+ }
+ parsed = _parse_all(tmp_path, files)
+ edges = _resolve_calls(parsed, tmp_path)
+ assert any(
+ "Caller.kt::Caller::run" in u
+ and "Single.kt::Single::do_it" in v
+ for u, v, _ in edges
+ ), edges
+
+
+class TestJavaMethodReference:
+ def test_method_reference_is_captured_as_call(self, tmp_path: Path) -> None:
+ """``Foo::bar`` should appear in CallSite list as receiver=Foo / target=bar."""
+ files = {
+ "src/main/java/com/foo/C.java": (
+ "java",
+ "package com.foo;\n"
+ "import java.util.stream.Stream;\n"
+ "class C {\n"
+ " void m() { Stream.of(1).map(Foo::bar); }\n"
+ "}\n",
+ ),
+ }
+ parsed = _parse_all(tmp_path, files)
+ calls = parsed["src/main/java/com/foo/C.java"].calls
+ assert any(
+ c.receiver_name == "Foo" and c.target_name == "bar"
+ for c in calls
+ ), calls
+
+ def test_method_reference_resolves_to_target_method(self, tmp_path: Path) -> None:
+ files = {
+ "src/main/java/com/foo/C.java": (
+ "java",
+ "package com.foo;\n"
+ "import java.util.stream.Stream;\n"
+ "class C {\n"
+ " void m() { Stream.of(1).map(Foo::bar); }\n"
+ "}\n",
+ ),
+ "src/main/java/com/foo/Foo.java": (
+ "java",
+ "package com.foo;\n"
+ "public class Foo {\n"
+ " public static Integer bar(Integer x) { return x; }\n"
+ "}\n",
+ ),
+ }
+ parsed = _parse_all(tmp_path, files)
+ edges = _resolve_calls(parsed, tmp_path)
+ assert any(
+ "C.java::C::m" in u and "Foo.java::Foo::bar" in v
+ for u, v, _ in edges
+ ), edges
diff --git a/tests/unit/ingestion/test_jvm_heritage.py b/tests/unit/ingestion/test_jvm_heritage.py
new file mode 100644
index 000000000..f5dc1ef7e
--- /dev/null
+++ b/tests/unit/ingestion/test_jvm_heritage.py
@@ -0,0 +1,102 @@
+"""Unit tests for Java sealed/permits heritage and JPMS provides scanning."""
+
+from __future__ import annotations
+
+from datetime import datetime
+from pathlib import Path
+
+import networkx as nx
+
+from repowise.core.ingestion.models import FileInfo
+from repowise.core.ingestion.parser import parse_file
+from repowise.core.ingestion.resolvers.context import ResolverContext
+from repowise.core.ingestion.resolvers.jvm_workspace import (
+ build_jvm_workspace_index,
+)
+
+
+def _fi(rel: str, abs_: Path, lang: str) -> FileInfo:
+ return FileInfo(
+ path=rel,
+ abs_path=str(abs_),
+ language=lang, # type: ignore[arg-type]
+ size_bytes=abs_.stat().st_size,
+ git_hash="",
+ last_modified=datetime.now(),
+ is_test=False,
+ is_config=False,
+ is_api_contract=False,
+ is_entry_point=False,
+ )
+
+
+class TestSealedPermits:
+ def test_permits_emits_subclass_edges(self, tmp_path: Path) -> None:
+ src = (
+ "package com.foo;\n"
+ "public sealed class Shape permits Circle, Square {}\n"
+ )
+ rel = "Shape.java"
+ abs_ = tmp_path / rel
+ abs_.write_text(src)
+ pf = parse_file(_fi(rel, abs_, "java"), src.encode("utf-8"))
+ heritage = pf.heritage
+ # Expect two relations: Circle→Shape, Square→Shape, both extends.
+ kinds = sorted((h.child_name, h.parent_name, h.kind) for h in heritage)
+ assert ("Circle", "Shape", "extends") in kinds, kinds
+ assert ("Square", "Shape", "extends") in kinds, kinds
+
+ def test_sealed_interface_permits(self, tmp_path: Path) -> None:
+ src = (
+ "package com.foo;\n"
+ "public sealed interface IFace permits A, B {}\n"
+ )
+ rel = "IFace.java"
+ abs_ = tmp_path / rel
+ abs_.write_text(src)
+ pf = parse_file(_fi(rel, abs_, "java"), src.encode("utf-8"))
+ kinds = sorted((h.child_name, h.parent_name, h.kind) for h in pf.heritage)
+ assert ("A", "IFace", "extends") in kinds, kinds
+ assert ("B", "IFace", "extends") in kinds, kinds
+
+
+class TestJpmsProvides:
+ def test_module_info_provides_populates_services(self, tmp_path: Path) -> None:
+ mi = tmp_path / "module-info.java"
+ mi.write_text(
+ "module com.foo {\n"
+ " provides com.foo.Service with com.foo.impl.MyImpl, com.foo.impl.OtherImpl;\n"
+ "}\n"
+ )
+ ctx = ResolverContext(
+ path_set={"module-info.java"},
+ stem_map={"module-info": ["module-info.java"]},
+ graph=nx.DiGraph(),
+ repo_path=tmp_path,
+ )
+ index = build_jvm_workspace_index(ctx)
+ assert "com.foo.Service" in index.services
+ impls = index.services["com.foo.Service"]
+ assert "com.foo.impl.MyImpl" in impls
+ assert "com.foo.impl.OtherImpl" in impls
+
+ def test_module_info_merges_with_meta_inf_services(self, tmp_path: Path) -> None:
+ mi = tmp_path / "module-info.java"
+ mi.write_text(
+ "module com.foo {\n"
+ " provides com.foo.Plugin with com.foo.impl.A;\n"
+ "}\n"
+ )
+ sdir = tmp_path / "src/main/resources/META-INF/services"
+ sdir.mkdir(parents=True)
+ (sdir / "com.foo.Plugin").write_text("com.foo.impl.B\n")
+ ctx = ResolverContext(
+ path_set={"module-info.java"},
+ stem_map={"module-info": ["module-info.java"]},
+ graph=nx.DiGraph(),
+ repo_path=tmp_path,
+ )
+ index = build_jvm_workspace_index(ctx)
+ impls = index.services["com.foo.Plugin"]
+ assert "com.foo.impl.A" in impls
+ assert "com.foo.impl.B" in impls
diff --git a/tests/unit/ingestion/test_jvm_synthesis.py b/tests/unit/ingestion/test_jvm_synthesis.py
new file mode 100644
index 000000000..5d8aef73e
--- /dev/null
+++ b/tests/unit/ingestion/test_jvm_synthesis.py
@@ -0,0 +1,126 @@
+"""Unit tests for Java record, Kotlin data class / enum / object, and
+MapStruct / AutoValue / Immutables synthesis."""
+
+from __future__ import annotations
+
+from datetime import datetime
+from pathlib import Path
+
+from repowise.core.ingestion.models import FileInfo
+from repowise.core.ingestion.parser import parse_file
+
+
+def _fi(rel: str, abs_: Path, lang: str) -> FileInfo:
+ return FileInfo(
+ path=rel,
+ abs_path=str(abs_),
+ language=lang, # type: ignore[arg-type]
+ size_bytes=abs_.stat().st_size,
+ git_hash="",
+ last_modified=datetime.now(),
+ is_test=False,
+ is_config=False,
+ is_api_contract=False,
+ is_entry_point=False,
+ )
+
+
+def _names(tmp_path: Path, name: str, lang: str, src: str) -> list[str]:
+ f = tmp_path / name
+ f.write_text(src)
+ pf = parse_file(_fi(name, f, lang), src.encode("utf-8"))
+ return [s.name for s in pf.symbols]
+
+
+class TestJavaRecord:
+ def test_record_accessors_synthesized(self, tmp_path: Path) -> None:
+ names = _names(
+ tmp_path, "Pt.java", "java",
+ "public record Pt(int x, int y) {}\n",
+ )
+ assert "x" in names, names
+ assert "y" in names, names
+ assert "equals" in names, names
+ assert "hashCode" in names, names
+ assert "toString" in names, names
+
+ def test_record_canonical_ctor_includes_components(self, tmp_path: Path) -> None:
+ f = tmp_path / "Person.java"
+ src = "public record Person(String name, int age) {}\n"
+ f.write_text(src)
+ pf = parse_file(_fi("Person.java", f, "java"), src.encode("utf-8"))
+ ctors = [s for s in pf.symbols if s.name == "Person" and s.parent_name == "Person"]
+ assert len(ctors) == 1, [s.id for s in pf.symbols]
+ assert "String name" in ctors[0].signature
+ assert "int age" in ctors[0].signature
+
+
+class TestKotlinDataClass:
+ def test_data_class_emits_componentN_and_copy(self, tmp_path: Path) -> None:
+ names = _names(
+ tmp_path, "P.kt", "kotlin",
+ "data class P(val x: Int, val y: Int)\n",
+ )
+ assert "component1" in names, names
+ assert "component2" in names, names
+ assert "copy" in names, names
+ assert "equals" in names, names
+ assert "hashCode" in names, names
+ assert "toString" in names, names
+
+ def test_enum_emits_values_valueOf(self, tmp_path: Path) -> None:
+ names = _names(
+ tmp_path, "Color.kt", "kotlin",
+ "enum class Color { RED, GREEN, BLUE }\n",
+ )
+ assert "values" in names, names
+ assert "valueOf" in names, names
+
+ def test_object_emits_INSTANCE(self, tmp_path: Path) -> None:
+ names = _names(
+ tmp_path, "S.kt", "kotlin",
+ "object S { fun work() {} }\n",
+ )
+ assert "INSTANCE" in names, names
+
+ def test_plain_class_no_componentN(self, tmp_path: Path) -> None:
+ names = _names(
+ tmp_path, "C.kt", "kotlin",
+ "class C(val x: Int)\n",
+ )
+ assert "component1" not in names, names
+
+
+class TestJvmCodegen:
+ def test_mapstruct_mapper_emits_impl(self, tmp_path: Path) -> None:
+ names = _names(
+ tmp_path, "Mapper.java", "java",
+ "import org.mapstruct.Mapper;\n"
+ "@Mapper public interface UserMapper { String map(String s); }\n",
+ )
+ assert "UserMapperImpl" in names, names
+
+ def test_autovalue_emits_subclass(self, tmp_path: Path) -> None:
+ names = _names(
+ tmp_path, "Box.java", "java",
+ "import com.google.auto.value.AutoValue;\n"
+ "@AutoValue public abstract class Box {}\n",
+ )
+ assert "AutoValue_Box" in names, names
+
+ def test_immutables_emits_subclass(self, tmp_path: Path) -> None:
+ names = _names(
+ tmp_path, "Person.java", "java",
+ "import org.immutables.value.Value;\n"
+ "@Value.Immutable public interface Person { String name(); }\n",
+ )
+ assert "ImmutablePerson" in names, names
+
+ def test_no_annotation_no_synthesis(self, tmp_path: Path) -> None:
+ names = _names(
+ tmp_path, "Plain.java", "java",
+ "public class Plain {}\n",
+ )
+ assert "PlainImpl" not in names, names
+ assert "AutoValue_Plain" not in names, names
+ assert "ImmutablePlain" not in names, names
diff --git a/tests/unit/ingestion/test_jvm_type_refs.py b/tests/unit/ingestion/test_jvm_type_refs.py
new file mode 100644
index 000000000..d15a7484a
--- /dev/null
+++ b/tests/unit/ingestion/test_jvm_type_refs.py
@@ -0,0 +1,262 @@
+"""Unit tests for Java + Kotlin type-reference resolution.
+
+Validates that field / parameter / return / generic-arg / heritage type
+positions emit ``type_use`` edges across files via JvmWorkspaceIndex.
+"""
+
+from __future__ import annotations
+
+from datetime import datetime
+from pathlib import Path
+
+import networkx as nx
+import pytest
+
+from repowise.core.ingestion.models import FileInfo, ParsedFile
+from repowise.core.ingestion.parser import parse_file
+from repowise.core.ingestion.resolvers.context import ResolverContext
+from repowise.core.ingestion.type_ref_resolution import resolve_type_refs
+
+
+def _file_info(rel: str, abs_: Path, lang: str) -> FileInfo:
+ return FileInfo(
+ path=rel,
+ abs_path=str(abs_),
+ language=lang, # type: ignore[arg-type]
+ size_bytes=abs_.stat().st_size,
+ git_hash="",
+ last_modified=datetime.now(),
+ is_test=False,
+ is_config=False,
+ is_api_contract=False,
+ is_entry_point=False,
+ )
+
+
+def _make_repo_with(
+ tmp_path: Path,
+ files: dict[str, tuple[str, str]], # rel -> (language, content)
+) -> tuple[dict[str, ParsedFile], ResolverContext]:
+ """Parse every file, wire up a graph with file + symbol nodes, return
+ (parsed_files, resolver_context) ready for ``resolve_type_refs``.
+ """
+ parsed_files: dict[str, ParsedFile] = {}
+ graph = nx.DiGraph()
+ path_set: set[str] = set()
+ stem_map: dict[str, list[str]] = {}
+
+ for rel, (lang, content) in files.items():
+ abs_ = tmp_path / rel
+ abs_.parent.mkdir(parents=True, exist_ok=True)
+ abs_.write_text(content)
+ fi = _file_info(rel, abs_, lang)
+ pf = parse_file(fi, content.encode("utf-8"))
+ parsed_files[rel] = pf
+ path_set.add(rel)
+ stem = rel.rsplit("/", 1)[-1].rsplit(".", 1)[0].lower()
+ stem_map.setdefault(stem, []).append(rel)
+
+ graph.add_node(rel, node_type="file", path=rel)
+ for sym in pf.symbols:
+ graph.add_node(sym.id, node_type="symbol", name=sym.name)
+ graph.add_edge(rel, sym.id, edge_type="defines")
+
+ ctx = ResolverContext(
+ path_set=path_set,
+ stem_map=stem_map,
+ graph=graph,
+ repo_path=tmp_path,
+ )
+ return parsed_files, ctx
+
+
+def _type_use_edges(graph: nx.DiGraph) -> list[tuple[str, str, str]]:
+ return [
+ (u, v, ",".join(d.get("type_uses", [])))
+ for u, v, d in graph.edges(data=True)
+ if d.get("edge_type") == "type_use"
+ or "type_uses" in d
+ ]
+
+
+class TestJavaTypeRefs:
+ def test_field_type_resolves_to_sibling(self, tmp_path: Path) -> None:
+ parsed, ctx = _make_repo_with(
+ tmp_path,
+ {
+ "src/main/java/com/foo/A.java": (
+ "java",
+ "package com.foo;\npublic class A {\n private Bar bar;\n}\n",
+ ),
+ "src/main/java/com/foo/Bar.java": (
+ "java",
+ "package com.foo;\npublic class Bar {}\n",
+ ),
+ },
+ )
+ resolve_type_refs(parsed, ctx, ctx.graph)
+ edges = _type_use_edges(ctx.graph)
+ assert any(
+ "src/main/java/com/foo/A.java" == u
+ and "src/main/java/com/foo/Bar.java" == v
+ and "Bar" in names
+ for u, v, names in edges
+ ), edges
+
+ def test_constructor_param_type_resolves(self, tmp_path: Path) -> None:
+ parsed, ctx = _make_repo_with(
+ tmp_path,
+ {
+ "src/main/java/com/foo/Svc.java": (
+ "java",
+ "package com.foo;\npublic class Svc {\n public Svc(Repo r) {}\n}\n",
+ ),
+ "src/main/java/com/foo/Repo.java": (
+ "java",
+ "package com.foo;\npublic class Repo {}\n",
+ ),
+ },
+ )
+ resolve_type_refs(parsed, ctx, ctx.graph)
+ edges = _type_use_edges(ctx.graph)
+ assert any(
+ u == "src/main/java/com/foo/Svc.java"
+ and v == "src/main/java/com/foo/Repo.java"
+ for u, v, _ in edges
+ ), edges
+
+ def test_generic_arg_resolves(self, tmp_path: Path) -> None:
+ """``List<UserPref>`` should resolve UserPref even though List is a builtin."""
+ parsed, ctx = _make_repo_with(
+ tmp_path,
+ {
+ "src/main/java/com/foo/Holder.java": (
+ "java",
+ "package com.foo;\nimport java.util.List;\n"
+ "public class Holder {\n private List<UserPref> prefs;\n}\n",
+ ),
+ "src/main/java/com/foo/UserPref.java": (
+ "java",
+ "package com.foo;\npublic class UserPref {}\n",
+ ),
+ },
+ )
+ resolve_type_refs(parsed, ctx, ctx.graph)
+ edges = _type_use_edges(ctx.graph)
+ assert any(
+ u == "src/main/java/com/foo/Holder.java"
+ and v == "src/main/java/com/foo/UserPref.java"
+ for u, v, _ in edges
+ ), edges
+
+ def test_builtin_filtered(self, tmp_path: Path) -> None:
+ """``String foo`` should NOT emit a type_use edge."""
+ parsed, ctx = _make_repo_with(
+ tmp_path,
+ {
+ "src/main/java/com/foo/A.java": (
+ "java",
+ "package com.foo;\npublic class A {\n"
+ " private String name; private int count;\n}\n",
+ ),
+ "src/main/java/com/foo/B.java": (
+ "java",
+ "package com.foo;\npublic class B {}\n",
+ ),
+ },
+ )
+ resolve_type_refs(parsed, ctx, ctx.graph)
+ edges = _type_use_edges(ctx.graph)
+ # No String / int → no edges to anywhere
+ assert all(v != "src/main/java/com/foo/B.java" for _, v, _ in edges), edges
+
+ def test_extends_emits_type_use(self, tmp_path: Path) -> None:
+ parsed, ctx = _make_repo_with(
+ tmp_path,
+ {
+ "src/main/java/com/foo/Child.java": (
+ "java",
+ "package com.foo;\npublic class Child extends Parent {}\n",
+ ),
+ "src/main/java/com/foo/Parent.java": (
+ "java",
+ "package com.foo;\npublic class Parent {}\n",
+ ),
+ },
+ )
+ resolve_type_refs(parsed, ctx, ctx.graph)
+ edges = _type_use_edges(ctx.graph)
+ assert any(
+ u == "src/main/java/com/foo/Child.java"
+ and v == "src/main/java/com/foo/Parent.java"
+ for u, v, _ in edges
+ ), edges
+
+
+class TestKotlinTypeRefs:
+ def test_primary_ctor_param_resolves(self, tmp_path: Path) -> None:
+ parsed, ctx = _make_repo_with(
+ tmp_path,
+ {
+ "src/main/kotlin/com/foo/Svc.kt": (
+ "kotlin",
+ "package com.foo\nclass Svc(val r: Repo)\n",
+ ),
+ "src/main/kotlin/com/foo/Repo.kt": (
+ "kotlin",
+ "package com.foo\nclass Repo\n",
+ ),
+ },
+ )
+ resolve_type_refs(parsed, ctx, ctx.graph)
+ edges = _type_use_edges(ctx.graph)
+ assert any(
+ u == "src/main/kotlin/com/foo/Svc.kt"
+ and v == "src/main/kotlin/com/foo/Repo.kt"
+ for u, v, _ in edges
+ ), edges
+
+ def test_nullable_type_resolves(self, tmp_path: Path) -> None:
+ parsed, ctx = _make_repo_with(
+ tmp_path,
+ {
+ "src/main/kotlin/com/foo/Holder.kt": (
+ "kotlin",
+ "package com.foo\nclass Holder { val r: Repo? = null }\n",
+ ),
+ "src/main/kotlin/com/foo/Repo.kt": (
+ "kotlin",
+ "package com.foo\nclass Repo\n",
+ ),
+ },
+ )
+ resolve_type_refs(parsed, ctx, ctx.graph)
+ edges = _type_use_edges(ctx.graph)
+ assert any(
+ u == "src/main/kotlin/com/foo/Holder.kt"
+ and v == "src/main/kotlin/com/foo/Repo.kt"
+ for u, v, _ in edges
+ ), edges
+
+ def test_kotlin_resolves_to_java_sibling(self, tmp_path: Path) -> None:
+ """Kotlin file references a Java sibling in the same package — no import."""
+ parsed, ctx = _make_repo_with(
+ tmp_path,
+ {
+ "src/main/java/com/foo/Caller.kt": (
+ "kotlin",
+ "package com.foo\nclass Caller(val svc: Service)\n",
+ ),
+ "src/main/java/com/foo/Service.java": (
+ "java",
+ "package com.foo;\npublic class Service {}\n",
+ ),
+ },
+ )
+ resolve_type_refs(parsed, ctx, ctx.graph)
+ edges = _type_use_edges(ctx.graph)
+ assert any(
+ u == "src/main/java/com/foo/Caller.kt"
+ and v == "src/main/java/com/foo/Service.java"
+ for u, v, _ in edges
+ ), edges
diff --git a/tests/unit/ingestion/test_lombok_synthesis.py b/tests/unit/ingestion/test_lombok_synthesis.py
new file mode 100644
index 000000000..b9c94cc89
--- /dev/null
+++ b/tests/unit/ingestion/test_lombok_synthesis.py
@@ -0,0 +1,120 @@
+"""Unit tests for Lombok synthetic-symbol synthesis."""
+
+from __future__ import annotations
+
+from datetime import datetime
+from pathlib import Path
+
+from repowise.core.ingestion.models import FileInfo
+from repowise.core.ingestion.parser import parse_file
+
+
+def _fi(rel: str, abs_: Path) -> FileInfo:
+ return FileInfo(
+ path=rel,
+ abs_path=str(abs_),
+ language="java",
+ size_bytes=abs_.stat().st_size,
+ git_hash="",
+ last_modified=datetime.now(),
+ is_test=False,
+ is_config=False,
+ is_api_contract=False,
+ is_entry_point=False,
+ )
+
+
+def _parse(tmp_path: Path, name: str, src: str) -> list:
+ f = tmp_path / name
+ f.write_text(src)
+ pf = parse_file(_fi(name, f), src.encode("utf-8"))
+ return [s.name for s in pf.symbols]
+
+
+def _parse_full(tmp_path: Path, name: str, src: str):
+ f = tmp_path / name
+ f.write_text(src)
+ return parse_file(_fi(name, f), src.encode("utf-8"))
+
+
+class TestLombok:
+ def test_required_args_constructor_synthesizes_ctor(self, tmp_path: Path) -> None:
+ pf = _parse_full(
+ tmp_path, "Svc.java",
+ "import lombok.*;\n"
+ "@RequiredArgsConstructor\n"
+ "public class Svc {\n"
+ " private final Repo repo;\n"
+ " private final Cache cache;\n"
+ " private String mutable;\n"
+ "}\n",
+ )
+ # The class itself is one Symbol; @RAC synthesises a ctor with
+ # parent_name == "Svc" so its id is "Svc.java::Svc::Svc".
+ ctors = [
+ s for s in pf.symbols
+ if s.name == "Svc" and s.parent_name == "Svc"
+ ]
+ assert len(ctors) == 1, [s.id for s in pf.symbols]
+ # Signature should include the two final fields, not the mutable one
+ assert "Repo repo" in ctors[0].signature
+ assert "Cache cache" in ctors[0].signature
+ assert "mutable" not in ctors[0].signature
+
+ def test_slf4j_emits_log_field(self, tmp_path: Path) -> None:
+ names = _parse(
+ tmp_path, "Svc.java",
+ "import lombok.extern.slf4j.Slf4j;\n"
+ "@Slf4j public class Svc {}\n",
+ )
+ assert "log" in names, names
+
+ def test_data_emits_getters_setters_toString_equals(self, tmp_path: Path) -> None:
+ names = _parse(
+ tmp_path, "Pt.java",
+ "import lombok.Data;\n"
+ "@Data public class Pt { private int x; private int y; }\n",
+ )
+ assert "getX" in names, names
+ assert "getY" in names, names
+ assert "setX" in names, names
+ assert "setY" in names, names
+ assert "toString" in names, names
+ assert "equals" in names, names
+ assert "hashCode" in names, names
+
+ def test_value_emits_getters_but_not_setters(self, tmp_path: Path) -> None:
+ names = _parse(
+ tmp_path, "V.java",
+ "import lombok.Value;\n"
+ "@Value public class V { int x; int y; }\n",
+ )
+ assert "getX" in names, names
+ assert "setX" not in names, names
+
+ def test_builder_emits_inner_builder_class_and_factory(self, tmp_path: Path) -> None:
+ names = _parse(
+ tmp_path, "B.java",
+ "import lombok.Builder;\n"
+ "@Builder public class B { private int x; }\n",
+ )
+ assert "BBuilder" in names, names
+ assert "builder" in names, names
+ assert "build" in names, names
+
+ def test_boolean_field_gets_is_getter(self, tmp_path: Path) -> None:
+ names = _parse(
+ tmp_path, "X.java",
+ "import lombok.Getter;\n"
+ "@Getter public class X { private boolean active; private String name; }\n",
+ )
+ assert "isActive" in names, names
+ assert "getName" in names, names
+
+ def test_no_lombok_no_synthesis(self, tmp_path: Path) -> None:
+ names = _parse(
+ tmp_path, "P.java",
+ "public class P { private int x; }\n",
+ )
+ assert "getX" not in names, names
+ assert "log" not in names, names