Repository navigation
fix(java): reading another class's constant doesn't read the file's own - #3189
Merged
Merged
Conversation
The value-reference pass links a symbol to the same-file constants its body reads, and it matched identifiers by name alone: elasticsearch's `RerankRequest.parseStringOrObject` passed for a reader of its own `PARSER` because it reads `InferenceString.PARSER`. The fix, in the wasm extractor (isForeignJavaField) and the kernel (is_foreign_field) alike: an identifier that is the field of a `field_access` counts only through `this` or through the class that declares the constant. Validation: - java-value-reads.test.ts: 1 of 2 cases fails on main without the kernel, all pass with and without it. - Kernel parity, java: jsoup, Minestom and rocksdb's java/ 2,267 of 2,301 files byte-identical, 34 deferred to wasm, 0 with diffs; elasticsearch's action and cluster packages 1,269 of 1,270, spring-ai and kestra 5,488 of 5,489, 0 with diffs. - A/B against main 4499d00: value references dropped, elasticsearch 226, Minestom 72, kestra 19, jsoup 1, spring-ai and okhttp 0. A check over each dropped edge's source finds no bare, `this.` or owner-qualified read of the constant in any of them (`LeafBucketCollector.NO_OP_COLLECTOR` passes for one by its suffix, 3 times: it is a read of another class). - Kotlin and Swift have the same reader, and it matters little there (2 of 31 and 3 of 496 on nowinandroid and okhttp), so they stay as they are. - CPU: with the Java overloads PR, which has the numbers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bompus
added a commit
to bompus/codegraph
that referenced
this pull request
Nov 2, 2026
…wn (colbymchenry#3189) Ported from upstream c344366. `InferenceString.PARSER` reads that class's constant, not the `PARSER` of the file reading it, but value references went by the identifier alone: a method of elasticsearch's `RerankRequest` passed for a reader of its own `PARSER` because it read `InferenceString.PARSER`. A read through a qualifier now counts when the qualifier is `this` or names the class that declares the constant. The generic extractor's value-ref pass gains the same rule. Also brings the TS extractor's interface-constant, Kotlin-property visibility, `fun interface` and receiver-chain changes so the generic extractor and the kernel still agree on the parity fixtures.
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.
The value-reference pass links a symbol to the same-file constants its body
reads, and it matched identifiers by name alone: elasticsearch's
RerankRequest.parseStringOrObjectpassed for a reader of its ownPARSERbecause it reads
InferenceString.PARSER.The fix, in the wasm extractor (isForeignJavaField) and the kernel
(is_foreign_field) alike: an identifier that is the field of a
field_accesscounts only through
thisor through the class that declares the constant.Validation:
pass with and without it.
byte-identical, 34 deferred to wasm, 0 with diffs; elasticsearch's action and
cluster packages 1,269 of 1,270, spring-ai and kestra 5,488 of 5,489, 0 with
diffs.
Minestom 72, kestra 19, jsoup 1, spring-ai and okhttp 0. A check over each
dropped edge's source finds no bare,
this.or owner-qualified read of theconstant in any of them (
LeafBucketCollector.NO_OP_COLLECTORpasses for oneby its suffix, 3 times: it is a read of another class).
and 3 of 496 on nowinandroid and okhttp), so they stay as they are.
Suite: 874 files passed, 6 skipped; 10,847 tests passed, 2 expected fail, 87 skipped, with the kernel on Windows, on the stack of these 8 PRs at 00b79ff2 over main 1f188da. The A/B numbers are against 4499d00; the stack on 1f188da is edge for edge the same arm on jsoup, rocksdb's java/, Minestom, okhttp, tokio, caddy, Alamofire, nowinandroid and mihon, and those repos give the same graph on both mains.
🤖 Generated with Claude Code