Object cannot be cast to class retrofit2.ServiceMethod
swankjesse opened this issue · comments
Jesse Wilson commented
I ran into this with Retrofit 2.10.
java.lang.ClassCastException: class java.lang.Object cannot be cast to class retrofit2.ServiceMethod (java.lang.Object is in module java.base of loader 'bootstrap'; retrofit2.ServiceMethod is in unnamed module of loader 'app')
at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:246)
at retrofit2.Retrofit$1.invoke(Retrofit.java:177)
at jdk.proxy3/jdk.proxy3.$Proxy139.addPullRequestLabel(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at misk.client.ClientInvocationHandler.invoke(ClientInvocationHandler.kt:125)
at jdk.proxy3/jdk.proxy3.$Proxy139.addPullRequestLabel(Unknown Source)
at com.squareup.cash.treelot.github.PullRequestMaker.addLabels(PullRequestMaker.kt:237)
Jesse Wilson commented
I had misconfigured my method, but rather than a helpful error message I got a Retrofit internal crash. I think we need to make loadServiceMethod
handle the case where parseAnnotations
throws.