`class.name`?
# announcements
p
class.name
?
c
Copy code
class SomeClass {
    val name = // ???
}
s
I think @Paul Woitaschek meant
SomeClass.name
or something similar
p
Copy code
class SomeClass {
  val name = javaClass.name
}
👍 1
s
javaClass
is deprecated in favor
::class.java
?
c
@Paul Woitaschek, thanks, it worked @snrostov it's
val name: String = javaClass.name
vs
val name: String get() = this::class.java.name
and I haven't seen any deprecation warning anywhere regarding javaClass, have I missed something?
s
Oh, yes. I'm wrong. Only
KClass<T>.javaClass
is depricated.
Copy code
@Deprecated("Use 'java' property to get Java class corresponding to this Kotlin class or cast this instance to Any if you really want to get the runtime Java class of this implementation of KClass.", ReplaceWith("(this as Any).javaClass"), level = DeprecationLevel.ERROR)
This is in 1.2
And jsClass is javascript is deprecated too.
Copy code
@Deprecated("Use class literal and extension property `js` instead.", replaceWith = ReplaceWith("this::class.js"),
c
Oh, I haven't played with 1.2 yet.