I'm trying to reach a constant String value of the Class name. But I really don't understand why I get a modified String value. Here is the code that I'm working on:
class TestClass {
companion object {
@JvmField
val TAG1: String = this::class.java.name as String
val TAG2: String = this::javaClass.name
}
}
In another class trying to reach the value like this:
class ComboClass {
override fun onStart() {
val tag1 = TestClass.TAG1
val tag2 = TestClass.TAG2
// tag1 "packagePath.TestClass$Companion"
// tag2 "packagePath.TestClass$Companion"
}
}
Why Am I getting packagePath.TestClass$Companion
at the end of the String value? I'm expecting to get packagePath.TestClass
Thanks