Skip to content

[Bug]: Java/Kotlin imports do not resolve to the class node, so affected silently omits dependents #4874

Closed

Description

@rafaelltlins

What happened?

In a mixed Java/Kotlin repository, references across the two languages do not reach the class node of the referenced symbol, so graphify affected <Class> returns an incomplete list with no warning. This makes impact analysis look complete when it is not.

Three cases, all from the minimal example below:

  1. Kotlin imports a Java class: the edge targets the file node (Logger.java), while Java importers also get an edge to the class node. affected "Logger" lists JavaUser.java but not KotlinUser.kt.
  2. Java imports or extends a Kotlin class: the edges target a separate source-less stub named after the fully qualified name (com.example.ui.BaseScreen). affected "BaseScreen" and affected "BaseScreen.kt" both omit JavaUser; only the fully qualified name finds it.
  3. Kotlin calls a Java method: no calls edge is created from KotlinUser.run() to Logger.info(), while the Java caller gets one.

Expected: affected "Logger" and affected "BaseScreen" each list both JavaUser and KotlinUser.

Steps to reproduce

# src/com/example/util/Logger.java
package com.example.util;
public class Logger { public static void info(String m) { System.out.println(m); } }

# src/com/example/ui/BaseScreen.kt
package com.example.ui
open class BaseScreen { fun show() {} }

# src/com/example/app/JavaUser.java
package com.example.app;
import com.example.util.Logger;
import com.example.ui.BaseScreen;
public class JavaUser extends BaseScreen { public void run() { Logger.info("java"); } }

# src/com/example/app/KotlinUser.kt
package com.example.app
import com.example.util.Logger
import com.example.ui.BaseScreen
class KotlinUser : BaseScreen() { fun run() { Logger.info("kotlin") } }

graphify update .
graphify affected "Logger" --depth 1
graphify affected "Logger.java" --depth 1
graphify affected "BaseScreen" --depth 1
graphify affected "com.example.ui.BaseScreen" --depth 1

Graph output

affected "Logger"       -> JavaUser.java [imports], .run() [calls]              (KotlinUser missing)
affected "Logger.java"  -> KotlinUser.kt [imports], JavaUser.java [imports]
affected "BaseScreen"   -> KotlinUser.kt [imports], KotlinUser [inherits]       (JavaUser missing)
affected "com.example.ui.BaseScreen" -> JavaUser.java [imports], JavaUser [inherits]

Edges in graph.json:
KotlinUser.kt  imports  Logger.java (file node)
JavaUser.java  imports  Logger.java (file node)
JavaUser.java  imports  Logger (class node)
KotlinUser.kt  imports  BaseScreen (class node)
JavaUser.java  imports  com.example.ui.BaseScreen (stub, no source_file)
JavaUser       inherits com.example.ui.BaseScreen (stub, no source_file)
KotlinUser     inherits BaseScreen (class node)
JavaUser.run() calls    Logger.info()
(no calls edge from KotlinUser.run())

Environment

  • Graphify version: 0.9.92 and 0.9.97
  • Operating system: Windows
  • Python: 3.14
  • Installation method: uv tool install
  • No provider API keys set

Additional context

Same output on 0.9.92 and 0.9.97. Also seen in a private mixed Android project, where a widely used Java class lost all of its Kotlin importers in affected.

Possibly related: #2322 (Kotlin cross-file import resolution). #1718 keeps calls from binding across language families; Java and Kotlin share the JVM and call each other directly, so that rule may not fit this pair.

Activity

  1. github-actions commented on Oct 30, 2026

    @github-actions

    Thanks for opening this issue, @rafaelltlins. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

  2. safishamsi commented on Nov 1, 2026

    @safishamsi
    Member

    Fixed in v0.9.100 via #4879 (pip install graphifyy==0.9.100). Java and Kotlin imports, inheritance and member calls resolve across files and across the two languages. Thanks for the report, @rafaelltlins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions