xenoterracide
01/15/2019, 4:51 PM::javaClass
and ::class.java
Shawn
01/15/2019, 4:53 PM// Will default to Foo's companion class if there is one
// otherwise it complains
// "Classifier 'Foo' does not have a companion object and thus must be initialized here"
Foo
// KClass<Foo>
Foo::class
// java.lang.Class<Foo>
Foo::class.java
// don't use this.
// yields some kinda generic `Class<T>` that isn't useful for comparison
Foo::javaClass
// yields the same thing as Foo::class.java, use this on instances
// to match against the class type if you need to
foo.javaClass
// e.g.
when (foo.javaClass) {
Foo::class.java -> { ... }
}
hudsonb
01/15/2019, 5:05 PMjavaClass
, what it resolves to can change depending on class usagejavaClass.getResourceAsStream
in a UI class and it was working fine. When I converted that UI class into a Fragment
in TornadoFX suddenly none of my resources can be found. class.java
works in both cases.nfrankel
01/15/2019, 6:01 PM