Skip to content
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

Internal property in a component #263

Closed
armatys opened this issue Apr 26, 2023 · 1 comment
Closed

Internal property in a component #263

armatys opened this issue Apr 26, 2023 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@armatys
Copy link

armatys commented Apr 26, 2023

Having this test case (based on ComponentTest.kt):

@Component abstract class Component5 {
    internal abstract val foo: InternalFoo
}

class ComponentTest {
    @Test
    fun generates_a_component_that_provides_a_internal_dep() {
        val component: Component5 = Component5::class.create()

        assertThat(component.foo).isNotNull()
        assertThat(component::foo.visibility).isEqualTo(KVisibility.INTERNAL)
    }
}

When trying to build the tests ./gradlew :integration-tests:ksp:test there's an error:

e: .../kotlin-inject/integration-tests/ksp/build/generated/ksp/jvmTest/kotlin/me/tatarka/inject/test/InjectComponent5.kt: (8, 23):
'public' property exposes its 'internal' type InternalFoo

The generated component looks like this:

public class InjectComponent5() : Component5() {
  public override val foo: InternalFoo // <-`foo` is public, even though it's been declared as `internal`
    get() = InternalFoo()
}

Is it valid usage?

@evant evant added the bug Something isn't working label Apr 26, 2023
@evant evant added this to the v0.6.2 milestone Aug 27, 2023
@evant
Copy link
Owner

evant commented Aug 27, 2023

Looks like this was fixed in kotlinpoet square/kotlinpoet#1550, so should be fixed in the next update.

@evant evant closed this as completed Aug 27, 2023
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

No branches or pull requests

2 participants