stanfit / android-extension

Android extensions library. Managed by Stanfit Inc.
https://stan-fit.com
MIT License
1 stars 0 forks source link

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

Open Kolyall opened 2 years ago

Kolyall commented 2 years ago

https://github.com/stanfit/android-extension/blob/cc182507fd447f2cddd795f7af6b6ad04809da94/extension/src/main/java/com/stanfit/android/extension/library/fragment/Fragment%2BResult.kt#L23

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

matsushitak commented 7 months ago

@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.