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

do not use T::class.java.name #2

Open
Kolyall opened this issue May 14, 2022 · 1 comment
Open

do not use T::class.java.name #2

Kolyall opened this issue May 14, 2022 · 1 comment

Comments

@Kolyall
Copy link

Kolyall commented May 14, 2022

setFragmentResult(T::class.java.name, bundleOf(NavResults::class.java.name to value))

do not use T::class.java.name , because after obfuscate here will be error in runtime

@matsushitak
Copy link
Member

@Kolyall
Your understanding is mostly correct. If NavResults is inherited by a class and you use obfuscation tools like ProGuard or R8, the name of the class implementing NavResults might be obfuscated. However, as long as the relationship between NavResults and its implementing class is maintained during the obfuscation process, ours code should work as expected.

When you use T::class.java.name in your Kotlin code, it retrieves the fully qualified name of the class. In the case of obfuscation, the name might be changed, but it will be changed consistently throughout the application. As long as the obfuscation process is consistent and does not break the inheritance hierarchy, the functionality should remain intact.

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

No branches or pull requests

2 participants