Repository navigation
feat(extractor-java): charge inherited calls - #55
Merged
Merged
Conversation
A call to a method a corpus type inherits from a library type has no declaring type without the jar, so it was dropped (EdgeExtractor's emitTypeLevelCall, on UNKNOWN_TYPE_ID). AncestorCallLookup now charges it to the one library ancestor that could answer: an invocation of that stub, derived, naming the method (MM-6), counted ancestor-attributed; with two candidates it stays dropped, counted ambiguous-ancestor. Receivers: a written field, parameter or local; this; super; the implicit this of an unqualified call. It stays dropped when a corpus type of the closure declares the name or carries Lombok, and for an unqualified call a static import may bind. Only drops turn into edges. PetClinic: the five save/saveAndFlush writes become edges to the JpaRepository stub; the ten reads are unchanged. The Java fixture gains LedgerAdapter's super.post; dependent counts, explain goldens (fake client), the metrics side-car and the website tables move with it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh1VXWEqBhGUFQftJAY
A type whose declaration is corpus source (an anonymous class, a local
class, an enum constant body) is now walked as corpus in the ancestor
lookup whatever its id, never taken for a library candidate: an
unqualified call in `new LibCallback() { ... }` under a class extending
LibBase is ambiguous. Pass 3's ids already mapped anonymous classes to
their declared ids, so no measured model changes (PetClinic, Broadleaf,
fineract byte-identical); the tests now hold without that mapping.
Iface.super.m() starts at the named interface: Spoon writes it as the
super access's target, with no type, so the call was dropped.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PKCVh1VXWEqBhGUFQftJAY
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
codegraph | fb8025b | Commit Preview URL Branch Preview URL |
Nov 29 2026, 10:16 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #54: it names the member, so it builds on M24a's
member.A call to a method inherited from a library type had no edge at all. On Spring PetClinic,
owners.save(owner)is inherited fromJpaRepositorythrough the corpus interfaceOwnerRepository; without a classpath the call has no declaring type the extractor can name, so it was dropped. The outbound report of #54 therefore saw no write into Spring Data. This PR turns that drop into aderivededge to the library ancestor, naming the member, when the corpus leaves exactly one answer.The rule
For a call with no declaring type (dropped until now, in
emitTypeLevelCall),AncestorCallLookupemits an edge when all of these hold:this,super,Outer.this,Iface.super, or no receiver at all (then every enclosing class is looked through, as JLS §15.12.1 does).java.lang.Objectnever counts.The edge is an
invocationfrom an invocable and areferenceotherwise, to the stub of the type the corpus wrote (JpaRepository, thoughCrudRepositoryreally declaressave: only the jar could tell), withmemberset to the method's simple name and provenancederived.The call stays dropped when:
ambiguous-ancestor);import static org.mockito.Mockito.*);var, an untyped lambda parameter, a call's result or an array element.A type written in the corpus (anonymous class, local class, enum constant body) is walked as corpus and is never a candidate. The rule only ever turns a drop into an edge: no existing edge changes.
The extractor's summary gains two lines, named as the Python and Ruby extractors name them:
ancestor-attributed : N (derived)andambiguous-ancestor : N (dropped).Measured
src/main/javasave/saveAndFlushsites (OwnerController:84,:168,VisitController:109,PetController:126,:199) are now edges to theJpaRepositorystub. The 10 read sites are byte-identical, and the model diff is exactly those 5 lines.org.springframework.data.jpa.repositoryasdatabaseandsave*→ write: 0 rows before, 5database/writerows after. No model call.Persistable.Before merging
TestCaseassertions, Spring'sOrdered) and Fineract (JpaRepository, Cucumber'sEn,SpringLiquibase) were all true.owners.findById(id)is still an edge to the corpus interface's own method, so it is no outbound row. Covering those needs a rule in the analyzer, not here.super.post(document)inLedgerAdapteris now an edge to theLedgerClientstub. With it moved the fixture snapshot, the metrics side-car, the counts in the analyzer, CLI and insights tests, the[named, eligible]pair for Java ([21, 62]), four website tables that tests pin, and the Java explain goldens (three units' fingerprints, regenerated with the fake client).Verification
On
fb8025b, which merges withmain(d9b7ade) without conflict:AncestorAttributedCallTest, plus two on the summary's counters../test.sh --java: 266 tests, 0 failures; the built jar and the native binary both reproduce the snapshot.pnpm -r testgreen: CLI 2 071, analyzer 942, insights 619 (1 skipped), core 618, vocabulary 364, viz 143, navigator-ui 124, city 98, llm 96, extractors/typescript 82, scm 56, navigator 45.pnpm -r buildgreen, the website included.pnpm run gen:schemaschanges nothing../test.sh --csharp,--elixir,--ruby,--python,--metrics: all checks passed.🤖 Generated with Claude Code
https://claude.ai/code/session_01PKCVh1VXWEqBhGUFQftJAY