darkmoon_uk
03/12/2020, 2:04 AM> Task :Examples:ExampleApplication:processDebugAnnotationsWithJavac FAILED
error: cannot access JvmStatic
class file for kotlin.jvm.JvmStatic not found
Consult the following stack trace for details.
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for kotlin.jvm.JvmStatic not found
1 error
When compiling Java referencing a Kotlin library, is it expected that the annotation processor requires Kotlin annotations to be defined?Joan Colmenero
03/12/2020, 10:52 AMreturn when {
pojo.dog != null -> {
mapDog(this, pojo = pojo.dog!!)
}
<http://pojo.cat|pojo.cat> != null -> {
mapCat(this, pojo = <http://pojo.cat|pojo.cat>!!)
}
else -> {
mapDefault(this)
}
}
I have to add the !!
because otherwise is saying
Smart cast is impossible because pojo.cat is an API class that is on a different module
Achraf Amil
03/12/2020, 2:16 PMiseki
03/12/2020, 2:50 PMinline fun <reified T: Any> awsl()
If I use it as: awsl<List<String>>()
How to get the String
from T
? Thank youChills
03/12/2020, 3:33 PMSam Garfinkel
03/12/2020, 4:18 PMthis
is not the receiver? For instance, if I’m wrapping an existing API in a DSL, a fun String.bar()
might behave differently depending on what this
is. I’m not able to subclass the wrapped API data type as it’s final, and inline classes don’t provide delegates apparently. I thought this would work:
class Foo {
fun doSomething(it: String) {
// TODO
}
}
inline class Bar(val foo: Foo) {
fun String.doSomething() = doSomething(this)
}
But Bar(Foo()).doSomething("hello")
is undefined.Gavin Ray
03/12/2020, 5:10 PMval sortedGames = games.sortedWith(compareBy{
Instant.now().compareTo(it.dateTime)
})
dazza5000
03/12/2020, 6:30 PMChills
03/13/2020, 4:34 AMkotlinc
commandxii
03/13/2020, 11:37 AMAlexander Eckert
03/13/2020, 1:30 PMclass MyClass<T : Comparable<T>> {
fun join(other : MyClass<T>) {
// so some stuff
}
}
fun someFunction(a : Any, b : Any) {
val instanceA = a as MyClass<*>
val instanceB = b as MyClass<*>
instanceA.join(instanceB)
}
LastExceed
03/13/2020, 4:03 PMChills
03/13/2020, 5:45 PMritesh
03/13/2020, 10:56 PMiseki
03/14/2020, 9:29 AMiseki
03/14/2020, 9:31 AMsultanofcardio
03/14/2020, 7:06 PM$this$methodName
codec
03/14/2020, 10:37 PMinterface Example {
default public void method(){
println("how default method implementations look in java, using the keyword default"
}
Travis Griggs
03/15/2020, 5:03 AMclass FungibleRecyclerAdapter<T : RecyclerView.ViewHolder>():RecyclerView.Adapter<RecyclerView.ViewHolder>() {
override fun onCreateViewHolder(parent:ViewGroup, viewType:Int):T {
return RecyclerView.ViewHolder()
}
override fun getItemCount():Int {
return 1
}
override fun onBindViewHolder(holder:T, position:Int) {
}
}
I got a couple of errors:
1. It complains that FungibleRecyclerAdatper is not a proper subclass because it doesn’t implement all of the methods it should
2. It complains that it does not know what the return ViewHolder() is not what it wants, a T
3. It complains that the onBindViewHolder doesn’t override any method
I can make a “normal” subclass of the Adapter where I specify a specific subclass of RecyclerView.ViewHolder if I want:
MyAdapter() : RecyclerView.Adapter<MyRowViewClass>() { … }
where MyRowViewClass
is a subclass of ViewHolder
just fine. But I wanted to make a generically pluggable one.Travis Griggs
03/15/2020, 5:04 AMsteenooo
03/15/2020, 3:59 PMGilberto Diaz
03/16/2020, 2:29 AMpavi2410
03/16/2020, 2:59 AMColton Idle
03/16/2020, 3:22 AMSlackbot
03/16/2020, 3:57 AMLastExceed
03/16/2020, 11:20 AMList
inherit from Set
? isn't a Set the same thing as a List but without indexing?Borja
03/16/2020, 12:00 PMritesh
03/16/2020, 12:06 PMMax
03/16/2020, 12:31 PMPiasy
03/16/2020, 1:34 PM?.
operator thread safe? for example I have a var str: String? = null
, is it safe to call str?.length
? could NPE happen?