While this is compiling, it looks like it won’t actually run, and I have no idea why. In our code we have this:
protected inline fun <reified TError> call(call: Call<TBody>, event: BaseEvent<TBody, TError>? = null, sticky: Boolean = true, async: Boolean = true, noinline onCompletion: (NetworkResponseWrapper<TBody, TError>) -> Unit = {}) {
this.call?.cancel()
this.call = call
if (async) {
launch {
_call(call, event, TError::class.java, onCompletion, sticky)
}
} else {
_call(call, event, TError::class.java, onCompletion, sticky)
}
}
/**
* Not intended to be used directly see call
*/
protected fun <TError> _call(call: Call<TBody>, event: BaseEvent<TBody, TError>?, type: Class<TError>, onSuccess: (NetworkResponseWrapper<TBody, TError>) -> Unit, sticky: Boolean) {
val res = handleCall(call, type)
if (event != null && !call.isCanceled) {
event.response = res
val sendSticky = hasSubscribersForEvent(event.javaClass) || sticky
postEvent(event, sendSticky)
}
this.call = null
onSuccess(res)
}
For which call() is then called from a class extending base service. This works if they are in the same package, but does NOT work if they are in they are not, with the exception stating _call() is not accessible to the extending class. Specifically,
05-17 12:03:02.670 23835-23963/com.heartmath.globalcoherencenetwork.internal.debug E/AndroidRuntime: FATAL EXCEPTION: ForkJoinPool.commonPool-worker-1
Process: com.heartmath.globalcoherencenetwork.internal.debug, PID: 23835
java.lang.IllegalAccessError: Method 'void com.heartmath.globalcoherencenetwork.data.BaseService._call(retrofit2.Call, com.heartmath.globalcoherencenetwork.model.event.BaseEvent, java.lang.Class, kotlin.jvm.functions.Function1, boolean)' is inaccessible to class 'com.heartmath.globalcoherencenetwork.data.service.LoginService$login$$inlined$call$1' (declaration of 'com.heartmath.globalcoherencenetwork.data.service.LoginService$login$$inlined$call$1' appears in base.apk)
at com.heartmath.globalcoherencenetwork.data.service.LoginService$login$$inlined$call$1.doResume(BaseService.kt:22)
at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resume(CoroutineImpl.kt:54)
at kotlinx.coroutines.experimental.DispatchTask.run(CoroutineDispatcher.kt:129)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1412)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:285)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1152)
at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1990)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1938)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:
I should mention that the login service does extend the BaseService