I have a Kotlin interface
interface MyKotlinInterface {
suspend fun mySuspendableMethod(): List<String>
}
then I created a Java class, and implemented MyKotlinInterface
public class MyJavaImpl implements MyKotlinInterface {
@Nullable
@Override
public Object mySuspendableMethod(@NotNull Continuation<? super List<? extends String>> completion) {
return null;
}
}
the IDE shows no error, but when I compile am getting below error
error: MyJavaImpl is not abstract and does not override abstract method mySuspendableMethod(Continuation<? super List>) in MyKotlinInterface public class MyJavaImpl implements MyKotlinInterface {
So my questions are
- Is it possible to do this?
- If it's not possible, why IDE doesn't show any error? and why IDE converts the
suspendmethod toContinuationparam.
- If it's possible, why am I getting this error? and How can I fix it?
UPDATE:
I've changed
@NotNull Continuation<? super List<? extends String>> completion
to
@NotNull Continuation completion
and the compile-time error has gone.
