dalexander
11/14/2018, 6:53 PM@JvmStatic
annotation. Anyone have any idea what’s going on? All of the documentation I can find seems to indicate that only the companion object itself should have static. This is causing problems the framework I’m using is trying to use reflection against the local properties and because they are static it’s not working. (This is on 1.3.0 in case it matters)Jonathan Walsh
11/14/2018, 11:42 PMpavel
11/15/2018, 12:08 AMval foo = gitlabEvent.webhookEvent.objectAttributes != null && gitlabEvent.webhookEvent.objectAttributes.action == Action.OPEN
gitlabEvent
and webhookEvent
are non-nullable. objectAttributes
is nullable. The compiler is telling me Smart cast to 'ObjectAttributes' is impossible, because 'gitlabEvent.webhookEvent.objectAttributes' is a complex expression
. I thought smart casting was smarter than that 😞stevecstian
11/15/2018, 1:04 AMbar
in Fred
is read-only, but the value returned from getter could be changed from time to time, right?silas.schwarz
11/15/2018, 9:23 AMAna Stu
11/15/2018, 11:59 AMBrian Trezise
11/15/2018, 1:34 PMbartvh
11/15/2018, 2:05 PMobject
), which cannot be constructed elsewhere without reflection, but I can't seem to get it any tighter than inner
. Making it private
will not allow to me create the one instance:
inner class TheLock internal constructor()
private val theLockInstance = TheLock()
inline fun <T> synced(block: (TheLock) -> T) =
synchronized(this) {
block(theLockInstance)
}
coder82
11/15/2018, 5:34 PMCasey Kulm
11/15/2018, 8:42 PMdavide
11/16/2018, 10:49 AMmuralimohan962
11/18/2018, 5:05 AMVenkatesh-Prasad Ranganath
11/18/2018, 8:13 PMSlackbot
11/18/2018, 11:17 PMrnpy
11/19/2018, 7:00 AMcompile-testing
library? (https://github.com/google/compile-testing)
currently I'm testing generated sources with a few regex, but that's really not optimal 😕kitttn
11/19/2018, 1:01 PMval customersSet = customers.collectToSet { it.phoneNumber }
which will make a set of customers with non-repeating phone numbersharoldadmin
11/19/2018, 4:32 PMmersan
11/19/2018, 5:55 PMdoSomething{
"a"
"b"
"c"
}
and i can read the input as an list or array of items?ImranH
11/19/2018, 7:37 PM//wins - horizontal
fun horizontalWin(letter: String, listIn: listOf<String>() ): boolean {
var counter = 0
for (element in listIn ) {
if (element == letter) {
counter++
}
}
if (counter == 3) return true
}
fun main(args: Array<String>) {
var row1 = listOf("X","O","_")
var checkForWin = horizontalWin("X", row1)
}
It s a bit rough and I am not sure if it makes sense, but I want to pass a list (or array) in and test it.
Thank you.Casey Kulm
11/19/2018, 7:40 PMreadLine()
to read user input. It is working fine when I run from Android Studio, although when I run from CLI with ./gradlew run
it seems to not be blocking to wait for readLine()
, and is immediately returning null
. Is there something I can do to achieve the expected behavior from CLI?ClaudiuB
11/19/2018, 8:51 PMfun isObjectOfSameType(first: Comparable?, second: Comparable?) : Boolean {
return first::class.java.isAssignableFrom(second)
}
however javaClass
or ::class.java
can't be called on Nullable
typestemp_man
11/19/2018, 8:59 PMjameskleeh
11/19/2018, 10:06 PMcamdenorrb
11/20/2018, 5:36 AMedwardwongtl
11/20/2018, 7:26 AMvalues
from a instance variable?
e.g.enum class Kind { Single, Double }
class A(val a: Kind)
A().a /// from here get the type of a and get its enum class, then get enum.values?
Bernhard
11/20/2018, 1:41 PMprivate inline fun <reified T> parseFile(files: Map<String, Path>,
fileName: String,
mapper: ObjectMapper): Array<T> =
files[fileName]
?.toFile()
?.readText()
?.let {
mapper.readValue<Array<T>>(it)
}
?: emptyArray()
Bernhard
11/20/2018, 2:41 PMinline private fun <reified T> persistData(data: Iterable<T>) { for (elem in data) }
Bernhard
11/20/2018, 2:44 PMOvsyannikov Alexey
11/20/2018, 2:48 PMsuspend
function from common function in common
module of gradle? I mean that in this module I have no runBlocking
extensionmersan
11/20/2018, 5:31 PMfun Project.`android`(configure: com.android.build.gradle.LibraryExtension.() -> Unit): Unit =
extensions.configure("android", configure)
why the android wrapped in ``?mersan
11/20/2018, 5:31 PMfun Project.`android`(configure: com.android.build.gradle.LibraryExtension.() -> Unit): Unit =
extensions.configure("android", configure)
why the android wrapped in ``?Reinis
11/20/2018, 6:33 PMVladyslav Sitalo
11/20/2018, 6:53 PM