sriharsha.hs
03/05/2018, 5:11 AMPlugin [id: 'MyPlugin'] was not found in any of the following sources:
Aregev2
03/05/2018, 5:29 AMMarc
03/05/2018, 8:26 AMiex
03/05/2018, 11:59 AMGregg
03/05/2018, 5:03 PMcarloxavier
03/05/2018, 5:08 PMaraqnid
03/05/2018, 6:18 PMnil2l
03/06/2018, 8:12 AMif ( val foo1 = foo?.first?.second?.third?.fourth?.fifth ){
}
Why just not?
foo?.first?.second?.third?.fourth?.fifth?.let { foo1 ->
…
}
ribesg
03/06/2018, 8:19 AM?.let{}
as a if
doesn't mean it needs an else
gildor
03/06/2018, 8:19 AMwhen
expression with assignment:
https://youtrack.jetbrains.com/issue/KT-4895
There is a big dissussion and looks like assignment inside when
is the best proposal imho.
Probably, if Kotlin team decide to implement this for when
it would make sense to do also for if
ribesg
03/06/2018, 8:25 AMinline fun <T : Any?, R> T.notNullOrElse(notNull: (T) -> R, orElse: (T) -> R): R =
if (this != null) notNull(this) else orElse(this)
val x: String? = "test"
x.notNullOrElse(
{ println(it) },
{ println("x is null") }
)
gildor
03/06/2018, 8:25 AMlet
now much less than before. Just because in many cases if
looks better, code more readable and obvious, especially comparing with let
+ elvis operatorw_bianrytree
03/06/2018, 11:43 AMkotlin.internal.contracts
?nish
03/06/2018, 1:01 PMsilas.schwarz
03/06/2018, 1:03 PMclass SomeHolder {
private val someMap = mutableMapOf<String,Any()>
private infix fun T String.from(transformation : (Any?)-> T?) =
transformation.invoke(someMap[this])
fun SomeHolder.test() {
//works but no return type assurance
"test" from {input ->
when(input) {
is String -> input.toFloatOrNull()
else -> null
}
}
//not working
"otherTest" from<Float> { input : Any? ->
when(input) {
is String -> input.toFloatOrNull()
else -> null
}
}
//not working
<Float> "yet another" from { input : Any? ->
when(input) {
is String -> input.toFloatOrNull()
else -> null
}
}
//not working
"yet another" <Float>from { input : Any? ->
when(input) {
is String -> input.toFloatOrNull()
else -> null
}
}
//not working
"arrrg" from { input : Any? ->
when(input) {
is String -> input.toFloatOrNull()
else -> null
}
}<Float>
}
}
silas.schwarz
03/06/2018, 2:01 PMOle
03/06/2018, 8:26 PMmarcoferrer
03/07/2018, 12:09 AMhoang
03/07/2018, 3:56 AMclass AClass {
lateinit var aLateInit: String
fun isInit() = this::aLateInit.isInitialized // OK
}
val obj1 = AClass()
val isInit = obj1::aLateInit.isInitialized // Not Compile
evanchooly
03/07/2018, 4:34 AMobj1.aLateInit.isInitialized
mike_shysh
03/07/2018, 8:37 AMval referenceServiceFeaturesConflicts = refResponse.serviceFeaturesConflicts
.sortedWith(compareBy({ it.addonPrecedence }, { it.sfName }))
val actualServiceFeatureConflicts = response.serviceFeaturesConflicts
.sortedWith(compareBy({ it.addonPrecedence }, { it.sfName }))
Danilo
03/07/2018, 9:35 AMelect
03/07/2018, 10:24 AMapomelov
03/07/2018, 11:37 AMany(Class)
argument matcher. Shortcuts like anyString
or anyInt
work. Even works with primitives like so: doNothing().when(mock).test(any(Int::class.java)
. But If I change Int
in this sample to smth more valuable, e.g. BigInteger, it fails with
You cannot use argument matchers outside of verification or stubbing.I'm mocking an interface with spring's MockBean annotation. What am I doing wrong?
miszmaniac
03/07/2018, 11:53 AMwarriorprincess
03/07/2018, 1:23 PMmarcoferrer
03/07/2018, 1:59 PMwarriorprincess
03/07/2018, 2:35 PMwarriorprincess
03/07/2018, 2:35 PMwarriorprincess
03/07/2018, 2:36 PMwarriorprincess
03/07/2018, 2:36 PMAndreas Sinz
03/07/2018, 2:36 PMsandwwraith
03/07/2018, 2:46 PM