yigit / android-priority-jobqueue

A Job Queue specifically written for Android to easily schedule jobs (tasks) that run in the background, improving UX and application stability.
3.4k stars 395 forks source link

Unreachable code kotlin #424

Closed nailbrother closed 6 years ago

nailbrother commented 6 years ago
override fun onRun() {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.

val call = ApiService.sendAction("hi")
val reponse = call.execute()
if(reponse?.isSuccessful!!){
Log.w("SENT_JOB", "onRun: body = " + response.body().string())
}

}

Hi, I get unreachable code for this code ! I'm using kotlin with android studio 3.1 canary 5 and gradle plugin 3.0.1. can anyone tell me why ? Thanks

nailbrother commented 6 years ago

It works with a @Suppress("UNREACHABLE_CODE") annotation ! but is there any other solutions ?

guerjon commented 6 years ago

Another Solution?

kalpeshp0310 commented 6 years ago

You should remove TODO("not implemented") //To change body of created functions use File | Settings | File Templates.

TODO() function in kotlin throws NotImplementedError making lines below this call unreachable. That's the reason behind IDE warning.

jrcinco commented 6 years ago

It is fixed when the TODO("not implemented") is removed or commented as //TODO("not implemented")