Skip to content

Import forms never resolved: Rust mod x;, Perl use A::B, Java static imports #3554

Closed

Description

@squid-protocol

Problem

tests/tools/import_graph_accuracy.py (merged in #3547) found three import forms that draw no dependency edge. Each is the language's standard way to bring in a sibling file.

language repo resolvable engine edges recall form
rust serde-rs/json 43 2 0.0% mod algorithm; in src/lexical/mod.rs → src/lexical/algorithm.rs (the module tree: x.rs or x/mod.rs beside a mod.rs/lib.rs/main.rs, else in the file's own stem directory)
perl libwww-perl/HTTP-Message 49 2 4.1% use HTTP::Headers::Util; in lib/HTTP/Headers.pm → lib/HTTP/Headers/Util.pm (:: → /, .pm, under an @INC root such as lib/)
java google/gson 1011 1007 98.2% (18 misses) import static com.google.gson.stream.JsonScope.DANGLING_NAME; → .../stream/JsonScope.java (a static import names a member; its file is the class's)

Also seen in the same run (Java precision 98.0%): tests importing ...TestTypes.BagOfPrimitives, a nested class, are linked to an unrelated top-level metrics/.../BagOfPrimitives.java by simple name.

Impact

  • Rust: in any crate split into modules, every mod file is an orphan in the import graph: no in-edges, wrong PageRank.
  • Perl: module-structured Perl gets almost no edges.
  • Java: a smaller hit. Classes reached only through static imports (constants holders, Preconditions-style utilities) lose in-edges.

Fix direction

These are three independent, language-scoped changes in the dependency capture or resolver:

  • Rust: capture mod name; (body-less) and resolve it by the module-tree rule above.
  • Perl: capture use/require of a Package::Name (capitalised, not a pragma) as the path Package/Name.pm.
  • Java: for import static a.b.C.m, drop the member and resolve a/b/C.java. For a nested-class import a.b.Outer.Inner, try a/b/Outer.java before a simple-name match.

Gate: import_graph_accuracy.py rust perl java. Regenerate that baseline and re-bless the golden masters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-engine

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions