New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IllegalArgumentException: wrong number of arguments #960
Comments
Can you share the full stacktrace? This is moshi’s new mechanism for dynamically invoking the synthetic defaults constructor that kotlin generates. |
|
It seems like the error changed in the snapshot from java.lang.IllegalArgumentException to java.lang.NoSuchMethodError |
does it work without mockito or in an otherwise reproducible test we could debug? Unfortunately the stacktrace and sample snippet alone doesn’t yield enough info to diagnose at a distance |
Actually - is you generated code compiled against an older snapshot? That would do it |
seeing the same in my project after updating to 1.9.0 today. it ends up being: |
If you look at your class's decompiled bytecode, does that constructor have two masks? My understanding was that Kotlin basically could not accept more than 32 default parameters |
I'm 99% sure two masks isn't a thing and it's a hard limit. The logic we use is almost identical to what kotlin-reflect does, unless it also doesn't work for this case |
wowow. Mind opening a separate issue to track that? That seems distinctly different from this one, and a limitation we'll need to figure out |
For now I'm going to close this one because I'm fairly certain it was a mismatch of runtime code and generated code. The method it's failing to find isn't the constructor, but rather the Util helper for doing it |
I upgraded to 1.9.0 and now I see the original error I reported. Here is the stack trace:
|
can you share a reproducible code snippet? Are you sure your models are being generated with the same version of moshi considering the original trace? |
Is there an email I can share the failing unit test to privately? |
Sure. pandanomic at gmail
…On Wed, Oct 30, 2019 at 3:41 PM Gábor Berényi ***@***.***> wrote:
Is there an email I can share the failing unit test to privately?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#960?email_source=notifications&email_token=AAKMJPUJ2UIRPVKMEMMD2J3QRHPONA5CNFSM4JFGJAHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECVQTSY#issuecomment-548080075>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKMJPXHHS45JRTOQP3WF6DQRHPONANCNFSM4JFGJAHA>
.
|
done, let me know if you figure it out |
Are you sure you sent it? I don't have anything on my end
…On Wed, Oct 30, 2019 at 5:46 PM Gábor Berényi ***@***.***> wrote:
done, let me know if you figure it out
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#960?email_source=notifications&email_token=AAKMJPXIVU563HUGHC2ZJ4LQRH6EXA5CNFSM4JFGJAHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECV37YA#issuecomment-548126688>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKMJPS3VGTIMIOS7TARD7LQRH6EXANCNFSM4JFGJAHA>
.
|
I send it again just now, maybe the zip attachment got blocked. Now it's a Google Drive link. |
Just got it, will look into it
…On Wed, Oct 30, 2019 at 6:23 PM Gábor Berényi ***@***.***> wrote:
I send it again just now, maybe the zip attachment got blocked. Now it's a
Google Drive link.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#960?email_source=notifications&email_token=AAKMJPXRUVJBVCERN2EP3DDQRICOPA5CNFSM4JFGJAHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECV6ZHQ#issuecomment-548138142>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKMJPVWSIFXZUUKDHFPKRLQRICOPANCNFSM4JFGJAHA>
.
|
Thanks for the test case @ber4444. I believe the new issue is the same as #977 and different than the original one posted here. #977 is fixed on master, your test case (at least with an empty json blob) works for me locally. Please try a master snapshot and see if that works for you locally to confirm? |
Thanks, the latest snapshot does work, so I guess you are right. |
In generated code
becomes
in the latest snapshot, resulting in "java.lang.IllegalArgumentException: wrong number of arguments" for
localConstructor.newInstance
why "mask" and "null" are added?
The text was updated successfully, but these errors were encountered: