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

fix scala 2.11 having problems finding default values of nested case classes because of uninitialized type metadata #51

Merged
merged 1 commit into from
Apr 28, 2021

Conversation

zzeekk
Copy link
Contributor

@zzeekk zzeekk commented Apr 18, 2021

Configs with scala 2.11 has problems finding default values of nested case classes. I had the following cases:

  • a case class at 2nd level has an attribute "xyz: Option[Boolean] = Some(true)". A config without this attribute is parsed as "xyz = None", not respecting its default value.
  • a case class at 2nd level has an attribute "xyz: Boolean = true". A config without this attribute throws an error that configuration for attribute "xyz" is missing. It seems that Configs doesn't know about its default value.

The strange thing about these errors is that they are not reproducible in unit tests of this project. I guess that it has to do with the numbers of macros that are generated in the project, and that scala optimizes loading of corresponding type metadata.

With this fix we can force scala to initialize type metadata before reading default values from it. This solves above cases.

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