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

Don't cache fragment classes across different class loaders #87

Conversation

simonschiller
Copy link
Contributor

Proposed Changes

  • Don't cache fragment classes across different class loaders inside FragmentFactory.

Testing

Test: Added tests to verify the change

Issues Fixed

Fixes: 113886460

val classLoader = CountingClassLoader()
factory.instantiate(classLoader, TestFragment::class.java.name)
factory.instantiate(classLoader, TestFragment::class.java.name)
assertEquals(1, classLoader.loadCount)
Copy link
Member

Choose a reason for hiding this comment

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

Please use Truth asserts (note, we already have a test dependency on Truth) over Junit asserts here and elsewhere in this file:

assertThat(classLoader.loadCount).isEqualTo(1)

Or preferably use the assertWithMessage() version that includes a more detailed message that is printed when the assert fails.

@ianhanniballake
Copy link
Member

Thanks for putting in this PR! It'll be available in the next Fragment release.

@simonschiller simonschiller deleted the feature/separate-cache-per-class-loader branch January 22, 2021 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants