https://kotlinlang.org logo
#getting-started
Title
# getting-started
e

elect

09/07/2021, 4:04 PM
I have an inline function calling on its turn a super inline function, but Idea warnings me
Accessing super members from public-API inline function is deprecated
why?
a

Alexey Belkov [JB]

09/08/2021, 7:54 AM
e

elect

09/08/2021, 7:56 AM
I don't get it, sorry
a

Alexey Belkov [JB]

09/08/2021, 8:53 AM
Can you please ask in the issue itself, so that the reason for deprecation is clearly documented in the issue tracker?
e

elect

09/08/2021, 9:57 AM
sure
👍 1
so Alexey, this did bite me just back at the end.. I need to call this:
Copy code
class Texture1d : Texture {
   inline fun <reified T> load(..): T =
I need
inline
+
reified
to comfortably pass down
T
, what possibilities do I have?
a

Alexey Belkov [JB]

11/02/2022, 6:06 AM
Sorry, can you please share a self-contained code sample and describe what the problem is?
e

elect

11/02/2022, 8:34 AM
sure, here you go, branch
super
as soon as you try to
build
, you'll get all the error about the super members
a

Alexey Belkov [JB]

11/02/2022, 9:34 AM
You can use the workaround described in https://youtrack.jetbrains.com/issue/KT-45379:
In order to get the similar behavior, the super call could be extracted to a separate function (having public visibility or internal visibility with @PublishedApi annotation).
e

elect

11/02/2022, 9:34 AM
I read that multiple times, but I couldn't figure it out how
so, this is my situation:
Copy code
inline fun <reified T> load(..): T = super.load<T>(..)
how can be this extracted exactly?
because if I try this:
Copy code
companion object {
    @JvmStatic
    inline fun <reified T> load(instance: Texture1d): T = instance.load<T>(Vec1i(), 0) 
}
problem persists
a

Alexey Belkov [JB]

11/02/2022, 9:50 AM
Hm, I’m not sure, maybe indeed there is no way. You could make the function internal and add some public non-inline overload I guess. You can create a YouTrack issue about it.
e

elect

11/02/2022, 10:15 AM
I'm afraid
@PublishedApi internal
can't help me
I have to write n methods for each single class..
15 Views