Skip to content
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

Prevent exception when old Moshi version on buildScript classpath #439

Merged
merged 1 commit into from
Sep 21, 2021

Conversation

fractalwrench
Copy link
Contributor

Goal

v5.8.0 added default values in these constructor parameters, which compiled to bytecode results in two constructors. This results in Moshi generating a slightly different JsonAdapter class, which needs to use the DEFAULT_CONSTRUCTOR_MARKER field to try and find the correct ctor.

If a user has a plugin in the buildscript classpath which has a dependency on an old version of Moshi (<1.9.1) then the DEFAULT_CONSTRUCTOR_MARKER is not present, resulting in a NoSuchFieldError being thrown.

This fixes the issue by avoiding the use of default parameters. The end-user should also update any plugins using an old version of Moshi.

Testing

Manually verified in an example app.

@fractalwrench fractalwrench marked this pull request as ready for review September 21, 2021 09:31
Copy link
Contributor

@lemnik lemnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fractalwrench fractalwrench merged commit a1fca43 into v5/next Sep 21, 2021
@fractalwrench fractalwrench deleted the remove-default-args branch September 21, 2021 13:21
@lemnik lemnik mentioned this pull request Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants