Commit d687d8f
feat(java): capture super() constructor-chain edges in the call graph (#138)
Round-4 Java deep-dive (spring-petclinic + commons-cli + gson). Three agents
audited code skeletons/CFG/type-inference, duplicate detection, and the MCP
context tools (orient/get_subgraph/get_signatures/...) — all returned clean
bills with the full rounds-1-3 regression sweep PASSing. The one genuine gap
left was constructor edges.
Java `super(...)` explicit constructor invocations were invisible to the call
graph (JAVA_CALL_QUERY only matched method_invocation / object_creation), so
class-hierarchy constructor chains never showed in impact analysis or fan-in/
out. synthesizeJavaSuperCalls now reads each class's parent from its `extends`
clause and emits a constructor-typed edge to the parent class's constructor
(constructors are keyed by class simple-name).
Deliberately scoped to avoid noise/regressions:
- this(...) is omitted — overloaded constructors collapse to one node, so it
would only ever be a self-loop.
- super(...) to a superclass outside the codebase (e.g. extends RuntimeException)
is dropped during resolution rather than turned into an external leaf node,
via a callType:'constructor' guard in Strategy 4. Java `new` edges leave
callType undefined, so existing behavior is untouched.
Verified: commons-cli yields 7 internal super() edges (e.g. AmbiguousOption-
Exception -> UnrecognizedOptionException); external superclasses add no node;
petclinic (implicit super only) correctly yields 0. Also added an explicit
package-info/module-info entity-filter regression test (agent suggestion).
Full suite green (3720 passing).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 133346d commit d687d8f
3 files changed
Lines changed: 133 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
310 | 337 | | |
311 | 338 | | |
312 | 339 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
644 | 644 | | |
645 | 645 | | |
646 | 646 | | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
647 | 695 | | |
648 | 696 | | |
649 | 697 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1637 | 1637 | | |
1638 | 1638 | | |
1639 | 1639 | | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
1640 | 1691 | | |
1641 | 1692 | | |
1642 | 1693 | | |
| |||
1704 | 1755 | | |
1705 | 1756 | | |
1706 | 1757 | | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
1707 | 1761 | | |
1708 | 1762 | | |
1709 | 1763 | | |
| |||
4226 | 4280 | | |
4227 | 4281 | | |
4228 | 4282 | | |
| 4283 | + | |
| 4284 | + | |
| 4285 | + | |
| 4286 | + | |
4229 | 4287 | | |
4230 | 4288 | | |
4231 | 4289 | | |
| |||
0 commit comments