Open lassem opened 4 years ago
Do you have a reproducing sample code snippet? Unfortunately not really actionable without one. If you can’t pinpoint one and the project is private, you can clone moshi locally, open it in an IDE, enable remote debugging on your project build, and then connect a remote debugger from the moshi IDE. If you set a breakpoint on that like you should be able to backtrack and see what class from your project it’s trying to process, then you can share that (or similar) as a repro case.
In the mean time we can try to add more information to the error message (such as the original property it’s analyzing). If I made a PR with such a change, would you be able to try that locally or an updated snapshot?
Absolutely!
We had an object defined like this:
@JsonClass(generateAdapter = true)
data class ScheduleInvoiceResponse(
val responseInfo: ResponseInfo?,
val result: Unit?
)
Wasn't immediately obvious where this problem lied, so some improvements to the actual error message would be nice.
That seems obvious, right?
Parameter with void, Unit, or Nothing type is illegal
Do you have a custom adapter for Unit that can somehow fulfill that model? I’m curious what the use case is vs making it Any?
We can try to make this error on the specific element though to make it more clear :+1:
We're trying to figure out exactly that. I changed it to Any?
as Unit?
didn't make much sense.
And no, no custom adapter in this case.
result
wasn't even used.
I am unable to pinpoint the exact reason why this happens, could really use some help in tracking this down.
(fwiw, 1.10.0-SNAPSHOT also has this issue)
Stacktrace from the build: