Skip to content

false positive for unused-dependency when referencing a named companion object by its default name #705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
RBusarow opened this issue Jun 1, 2022 · 0 comments · Fixed by #706
Labels
bug Something isn't working

Comments

@RBusarow
Copy link
Member

RBusarow commented Jun 1, 2022

given two files:

// in :lib-1
package com.example.common

class Subject {
  companion object Factory {
    fun create() = Subject()
  }
}
// in :lib-2
package com.example.common

val subject = Subject.create()

The companion object is named, so it can be referenced as com.example.common.Subject.Factory, but it can also just be com.example.common.Subject. And if it's referenced from the same package or with a wildcard import, that reference won't be resolved (by ModuleCheck).

In the above example, com.example.common.Subject and com.example.common.Subject.create should still be declarations.

@RBusarow RBusarow added the bug Something isn't working label Jun 1, 2022
@kodiakhq kodiakhq bot closed this as completed in #706 Jun 2, 2022
RBusarow added a commit that referenced this issue Jun 2, 2022
* main:
  parse the declarations of named companion objects and their members fixes #705
  use graphviz-java for dot graph generation
  Update dependency com.autonomousapps.dependency-analysis to v1.4.0
  Update dependency com.osacky.doctor to v0.8.1
  update website actions to use node 18.x
  treat annotation processor dependencies the same as runtime dependencies for `McProject.uses()` and overshot behavior (#701)

# Conflicts:
#	modulecheck-gradle/plugin/src/main/kotlin/modulecheck/gradle/internal/GradleProjectProvider.kt
#	modulecheck-project/testing/build.gradle.kts
#	modulecheck-project/testing/src/main/kotlin/modulecheck/project/test/McProjectBuilder.kt
#	modulecheck-project/testing/src/main/kotlin/modulecheck/project/test/ProjectCollector.kt
RBusarow added a commit that referenced this issue Jun 2, 2022
* main:
  parse the declarations of named companion objects and their members fixes #705
  use graphviz-java for dot graph generation
  Update dependency com.autonomousapps.dependency-analysis to v1.4.0
  Update dependency com.osacky.doctor to v0.8.1
  update website actions to use node 18.x
  treat annotation processor dependencies the same as runtime dependencies for `McProject.uses()` and overshot behavior (#701)

# Conflicts:
#	modulecheck-gradle/plugin/src/main/kotlin/modulecheck/gradle/internal/GradleProjectProvider.kt
#	modulecheck-project/testing/build.gradle.kts
#	modulecheck-project/testing/src/main/kotlin/modulecheck/project/test/McProjectBuilder.kt
#	modulecheck-project/testing/src/main/kotlin/modulecheck/project/test/ProjectCollector.kt
RBusarow added a commit that referenced this issue Jun 3, 2022
* main:
  parse the declarations of named companion objects and their members fixes #705
  use graphviz-java for dot graph generation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant