https://kotlinlang.org logo
#general-advice
Title
# general-advice
a

Alexander Städing

11/23/2023, 11:01 AM
I'm getting a really weird
java.lang.IllegalAccessError
. For some reason, I can't access methods from a companion object:
Copy code
java.lang.IllegalAccessError: class org.anvilpowered.catalyst.api.config.CatalystKeys$special$$inlined$buildingSimple$1 tried to access field org.anvilpowered.anvil.core.config.Key$Companion.$$INSTANCE
I'm using the latest Kotlin version 1.9.20. I first thought it was due to Java 21 support not being quite there yet, but it also happens with Java 17. Nothing in this class is private or protected. Here is the class that is being accessed: https://github.com/anvilpowered/anvil/blob/44a541f5ba065b2c05a4ecb00ea4e9930d9f6ad[…]/core/src/main/kotlin/org/anvilpowered/anvil/core/config/Key.kt Here is the code accessing the class: https://github.com/anvilpowered/catalyst/blob/8d89883a4f30fe80c1045feec0c5c3dc6269[…]ain/kotlin/org/anvilpowered/catalyst/api/config/CatalystKeys.kt Here is the full stacktrace: https://pastie.io/zccmsw.hs Is this a Kotlin bug or am I doing something wrong? Let me know if I should create a minimal example. Thanks for any advice.
3 Views