dumptruckman
02/07/2019, 5:04 PMdumptruckman
02/07/2019, 5:04 PMDico
02/07/2019, 5:39 PMval recipients = mutableListOf<String>()
fun recipients(vararg recipients: String) = apply { this.recipients.addAll(recipients.toList()) }
Dico
02/07/2019, 5:40 PMDico
02/07/2019, 5:41 PMDico
02/07/2019, 5:43 PMDico
02/07/2019, 5:44 PMoperator fun <T> MutableList<in T>.plusAssign(elem: T)
which plays nice with the recipients property.Dico
02/07/2019, 5:44 PMdumptruckman
02/07/2019, 6:05 PMRuckus
03/26/2019, 7:40 PMDavid Cuesta
03/27/2019, 10:10 AMglenkpeterson
03/27/2019, 9:24 PMinterface MyInterface {
val myVal: Boolean
companion object {
@JvmStatic
fun foo(m: MyInterface): Boolean = m.myVal
}
}
Now dozens of Java classes that implement MyInterface are showing red-underlined errors in IntelliJ IDEA, saying that they need to implement the static interface method foo (they don't). They compile just fine. I found this bug which seems to match exactly: https://youtrack.jetbrains.com/issue/KT-27208 but I don't understand why it's only got one thumbs up. If I'm the only one with this problem, I must be doing something else wrong. Thoughts?LeoColman
03/28/2019, 12:37 AMPaul Woitaschek
03/28/2019, 6:44 AMPaul Woitaschek
03/28/2019, 3:54 PMPaul Woitaschek
03/28/2019, 3:54 PMZachary Smith
03/28/2019, 10:24 PMput(key)
when deal with map? same for get(key)
? is it a performance thing?pavel
03/28/2019, 10:28 PMZachary Smith
03/28/2019, 10:30 PMpavel
03/28/2019, 10:30 PMZachary Smith
03/28/2019, 10:31 PMDavide Giuseppe Farella
03/28/2019, 11:22 PMDavide Giuseppe Farella
03/28/2019, 11:23 PMDavide Giuseppe Farella
03/28/2019, 11:26 PMMutableEntity.postSomething
and LockedEntiry.postSomething
from a class that implements Scope
bbaldino
03/29/2019, 7:48 PMinc
, for example, i'd just have to return a new instance of the inline class with the value incremented by 1?bbaldino
03/29/2019, 7:52 PMSmallville7123
03/29/2019, 9:39 PMbbaldino
03/29/2019, 10:42 PMbbaldino
03/29/2019, 10:42 PMclass Bar<T>(
val member: T
)
interface Parent<T> {
val member: T
}
class Sub(
override val member: Foo
) : Parent<Foo>
fun something(f: Foo) {}
fun main() {
val b = Bar(Foo(1))
val b2 = Sub(Foo(1))
something(b.member) // Works fine
something(b2.member) // Class cast exception: java.lang.Integer cannot be cast to org.jitsi.rtp.rtp.Foo
}
Smallville7123
03/30/2019, 12:08 AMimport java.io.File;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
fun fileToByteBuffer(f : File) : ByteBuffer {
val file = RandomAccessFile(f, "r")
val fileChannel = file.getChannel()
var i = 0
var buffer = ByteBuffer.allocate(fileChannel.size().toInt())
fileChannel.read(buffer)
buffer.flip()
return buffer
}
val filetmp = "/sda3_partition_resize_to_size"
class lexer(stm : ByteBuffer, delimiter : String) {
val f = stm
val delimiters = delimiter
fun clone() {
val ll = lexer(fileToByteBuffer(File(filetmp)), "none")
}
}
tasks.register("test") {
val lex = lexer(fileToByteBuffer(File(filetmp)), "none")
println("cloning")
lex.clone()
println("clone sucesfull")
}
app/build.gradle :
apply from: '../a/build.gradle.kts'
preBuild.dependsOn test
Executing tasks: [assemble]
> Configure project :app
cloning
FAILURE: Build failed with an exception.
* Where:
Build file '/home/macropreprocessor/AndroidStudioProjects/kpp/app/build.gradle' line: 35
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not create task ':app:test'.
> Build_gradle$lexer.<init>(Ljava/nio/ByteBuffer;Ljava/lang/String;)V
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at <https://help.gradle.org>
BUILD FAILED in 1s