KakaoCup / Kakao

Nice and simple DSL for Espresso in Kotlin
https://kakaocup.github.io/Kakao/
Apache License 2.0
324 stars 28 forks source link

getResourceDrawable not accessible after 3.5.0 upgrade (from 3.4.1) #107

Open sebastienrouif opened 9 months ago

sebastienrouif commented 9 months ago

Steps to reproduce:

  1. setup a project using 3.4.1 and access getResourceDrawable it will build
  2. upgrade to 3.5.0 function is not visible any more (still there in the code though)

Observed Results:

function is not found

Expected Results:

function should be accessible, visibility hasn't changed

Relevant Code:

  // code here

PR with reproduction on Sample App

Vacxe commented 7 months ago

3.5.0 ContextUtillsKt

// IntelliJ API Decompiler stub source generated from a class file
// Implementation of methods is not available

package io.github.kakaocup.kakao.common.utilities

public fun getResourceColor(@androidx.annotation.ColorRes resId: kotlin.Int): kotlin.Int { /* compiled code */ }

public fun getResourceDrawable(@androidx.annotation.DrawableRes resId: kotlin.Int): android.graphics.drawable.Drawable? { /* compiled code */ }

public fun getResourceString(@androidx.annotation.StringRes resId: kotlin.Int): kotlin.String { /* compiled code */ }
Vacxe commented 7 months ago

@sebastienrouif thanks for reporting. Will try to fix in the next release

Vacxe commented 7 months ago

Looks like issue related for Gradle configuration when functions declared without explicit classes

ContextUtills.kt

...

fun getResourceDrawable(@DrawableRes resId: Int) =
    ContextCompat.getDrawable(InstrumentationRegistry.getInstrumentation().targetContext, resId)

...

Classes not found

However if

...
object ContextUtils { 
...
fun getResourceDrawable(@DrawableRes resId: Int) =
    ContextCompat.getDrawable(InstrumentationRegistry.getInstrumentation().targetContext, resId)

...
}

All works as expected

Vacxe commented 7 months ago

112 + #114 should fix the issue

Vacxe commented 7 months ago

106