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

[resources] Init resource accessors lazily and in external function to avoid MethodTooLargeException #4404

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

terrakok
Copy link
Member

@terrakok terrakok commented Mar 1, 2024

Generated static acessors to resources look like kotlin objects with static properties.
A count of properties is limited by 500 to avoid a MethodTooLargeException when a generated init function of the object is to large. But this reproduces when one resource has a lot of variant in different locales, and it may increase the init function.

To handle it I extracted property initializers outside the init function.
As additional optimization I made static properties lazy to init them on demand.

fixes #4194

@terrakok terrakok requested a review from pjBooms March 1, 2024 14:27
@terrakok terrakok merged commit ca3ae45 into master Mar 4, 2024
6 checks passed
@terrakok terrakok deleted the k.tskh/fix-huge-locales branch March 4, 2024 10:26
igordmn pushed a commit that referenced this pull request Mar 5, 2024
@terrakok terrakok added the changelog1.6.1 Temporary label for 1.6.1 changelog (will be removed) label Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog1.6.1 Temporary label for 1.6.1 changelog (will be removed)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compilation fails with ~200 items in strings.xml (MethodTooLargeException)
2 participants