https://kotlinlang.org logo
Title
a

ansman

01/23/2018, 10:22 PM
Not sure if this is the best place for this but I’m having trouble accessing an
internal
class from a unit test in the same module. Android Studio shows no issues but when I try to compile I just get
Cannot access 'XXX': it is internal in 'YYY'
. This is using Kotlin 1.2.20
Here is a minimal example that fails to compile:
internal object Foo {
    const val foo = "foo"
}
class TestFoo {
    @Test
    fun testFoo() {
        assertEquals("foo", Foo.foo)
    }
}
It fails with this error:
TestFoo.kt: (10, 29): Cannot access 'Foo': it is internal in 'com.example'