Gopal S Akshintala
08/31/2021, 5:43 AMCollectionsKt
method directly in java and run this in a unit test. However this static import is causing this exception
import static kotlin.collections.CollectionsKt.chunked;
However, if I use CollectionsKt.chunked(…)
without the static import, I don’t get this exception:
java.lang.IllegalAccessError: failed to access class kotlin.collections.CollectionsKt___CollectionsKt from class billing.batch.invoice.services.tax.TaxIntegrator (kotlin.collections.CollectionsKt___CollectionsKt and billing.batch.invoice.services.tax.TaxIntegrator are in unnamed module of loader org.powermock2.core.classloader.javassist.JavassistMockClassLoader @5443d039)
javaru
08/31/2021, 2:54 PM@PowerMockIgnore
annotation to resolve the IllegalAccessError
problem in some cases. (As a side note, we were constantly running into issues with PowerMock in our project that we recently removed all use of it and are sticking with Mockito and MockK.)Gopal S Akshintala
08/31/2021, 2:56 PMjavaru
08/31/2021, 3:22 PMchunked
function in kotlin.collections.Collections
. Perhaps it was in an old version, or was experimental? That would definitely cause the error.Gopal S Akshintala
08/31/2021, 3:40 PMchunked
has been there for quite long: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/chunked.htmljavaru
08/31/2021, 3:44 PMGopal S Akshintala
08/31/2021, 3:46 PMimport static kotlin.collections.CollectionsKt.chunked;
javaru
08/31/2021, 3:55 PMCollections
source file rather than _Collections