Klitos Kyriacou
10/04/2022, 2:02 PMtry {
foo()
} catch (e: Exception) {
//...
} catch (e: RuntimeException) {
//...
}
The Java compiler rejects it because it knows that RuntimeException will never be caught as it appears after Exception. The Kotlin equivalent doesn't even trigger a warning in the IDE. Does the Kotlin plugin for IntelliJ IDEA have at least an option to turn on a warning for this?Curtis Ullerich
10/04/2022, 5:20 PMRuckus
10/05/2022, 2:06 PMGreg
10/05/2022, 6:01 PMDaniel Zayas
10/05/2022, 7:00 PMJose Garcia
10/06/2022, 11:28 AMClientRequestException
. However in 2.x, it seems that unsuccessful http responses are not throwing exceptions anymore. This is forcing us to check which status code we get on the response and throw our own custom NetworkError. I am wondering if there is anyone here that can have information on why is this done like that, we are thinking that may have something to do with the newly added retry functionality.Giorgi
10/06/2022, 12:26 PMStylianos Gakis
10/06/2022, 11:28 PMEventListener
. I prefer an abstract class over an interface here ’cause I want to introduce new functions in library upgrades without breaking compatibility.”
I always thought even if you’ve got an interface, you can introduce new functions with default implementations which would let consumers not need to do anything in implementation of that interface.
Am I missing something here?oday
10/07/2022, 9:55 AMimport as
in kotlin? I need to use two classes that are called the same but different packages and I dont want my entire package name behind each usage of one or the other to differentiateJasmin Fajkic
10/07/2022, 10:07 AMprivate fun <T1, T2, T3, T4, T5, T6, T7, R> combine(
flow: Flow<T1>,
flow2: Flow<T2>,
flow3: Flow<T3>,
flow4: Flow<T4>,
flow5: Flow<T5>,
flow6: Flow<T6>,
flow7: Flow<T7>,
transform: suspend (T1, T2, T3, T4, T5, T6, T7) -> R
): Flow<R> = combine(
combine(flow, flow2, flow3, ::Triple),
combine(flow4, flow5, flow6, ::Triple),
combine(flow7)
) { t1, t2, t3 ->
transform(
t1.first,
t1.second,
t1.third,
t2.first,
t2.second,
t2.third,
t3.first,
)
}
zt
10/08/2022, 11:35 PMjanvladimirmostert
10/09/2022, 4:51 PMobject A {
fun Server.wire() { TODO() }
}
object B {
fun Server.wire() { TODO() }
}
how do I call wire from both object A and B considering they're both extension functions?
Server().apply {
wire() // wire A
wire() // wire B
}
is it possible to do something like A::wire()
and B::wire()
?ephemient
10/10/2022, 6:44 PMGavin Ray
10/10/2022, 7:55 PMCompleteableFuture
interop
I'm not very familiar with JVM-style asynchrony (mostly used async/await style languages)
If I have a Java API which returns `CompleteableFuture`'s, is there a way to get them to run on coroutines instead of physical threads to reduce the overhead, or how do you generally work with these?Gavin Ray
10/10/2022, 7:56 PMRob Elliot
10/11/2022, 7:19 AMy
10/11/2022, 11:43 AMOleg Shuliak
10/11/2022, 2:27 PMcoroutineScope {
workflows.forEach {
it.status = formWorkflowActivationStateManager.getCurrentState(it, companyId).toWorkflowStatus()
}
}
I’m wondering if the coroutineScope
is enough to parallel those executions or if I need to use async/await
?Roque Sosa
10/11/2022, 6:25 PMy
10/12/2022, 6:54 AMthis
when possible?sarvagya agarwal
10/12/2022, 11:10 AMMoritz Post
10/12/2022, 1:50 PMlambdas.forEach { it() }
Erfannj En
10/12/2022, 2:05 PMAbdullah Samir
10/12/2022, 8:17 PMJustin Xu
10/13/2022, 1:19 AMUser
model object to be inserted into a database. I want to insert these into various databases using a Repository pattern, but the User
has an id
field that is generated differently for each database I use. Is there a way to defer the definition of the id
type and a generateId()
function until the actual creation of the User
object in Kotlin? ThanksBlitzer
10/13/2022, 3:30 AModay
10/13/2022, 3:42 PMwhen
like this one
when (locationState) {
!is LocationState.Set -> {}
is LocationState.Disabled -> onLocationDisabled()
is LocationState.NotGranted -> onLocationNotGranted()
else -> Unit
}
all the conditions after the first !is LocationState.Set
are now unreachable?martmists
10/13/2022, 4:20 PMLoney Chou
10/14/2022, 3:17 AMclass
only implies final
but override
only implies open
? Should "overridability" be `open`'s at all? I remember this is the only place where final
is used.
class A // final
interface B {
fun foo()
}
class C : B {
override fun foo() // final
}
open class D : B {
override fun foo() // OPEN
}
if it's final by default then D.foo
should also just finalize overridability UNLESS you mark it open
. Having both open
and final
is so inconsistent.Ellen Spertus
10/15/2022, 4:15 AMtrue
but not why the second one does. I'd only expect substrings of the alphabet to return true
. What's going on?Ellen Spertus
10/15/2022, 4:15 AMtrue
but not why the second one does. I'd only expect substrings of the alphabet to return true
. What's going on?Kevin Healy
10/15/2022, 4:30 AMEllen Spertus
10/15/2022, 4:36 AM"zz" in "a".."z"
vimlesh yadav
10/15/2022, 10:02 AMVampire
10/15/2022, 10:35 AMEllen Spertus
10/15/2022, 4:12 PMcompareTo()
it does.