Skip to content

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

Development

Successfully merging this pull request may close these issues.

3 participants