Skip to content

Incorrect advice when the same package name is used #1590

@SimonMarquis

Description

@SimonMarquis

Plugin version
lastest 3.4.1

Gradle version
9.1.0

JDK version
25

(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version
2.2.21

(Optional) Android Gradle Plugin (AGP) version
N/A

(Optional) reason output for bugs relating to incorrect advice

gradlew :bar:reason --id ":foo"

------------------------------------------------------------
You asked about the dependency ':foo'.
You have been advised to remove this dependency from 'implementation'.
------------------------------------------------------------

Shortest path from :bar to :foo for compileClasspath:
:bar
\--- :foo

Shortest path from :bar to :foo for runtimeClasspath:
:bar
\--- :foo

Shortest path from :bar to :foo for testCompileClasspath:
:bar
\--- :foo

Shortest path from :bar to :foo for testRuntimeClasspath:
:bar
\--- :foo

Source: main
------------
(no usages)

Source: test
------------
(no usages)

Describe the bug
The import of FOO from the other module is not detected.

To Reproduce

Reproducer project: https://github.com/SimonMarquis/DAGP-1590

// :foo
package com.example
const val FOO = "FOO"
// :bar
package com.example
const val BAR = FOO // This is not detected
// :bar
package com.example.other
import com.example.FOO
const val BAR = FOO // This is correctly detected

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already existstoolchain:kotlin

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions