Oussama Haff.
01/21/2019, 7:57 AMnatpryce
01/21/2019, 8:16 AMaballano
01/10/2020, 12:07 PMuser
01/10/2020, 5:45 PMpardom
01/10/2020, 7:07 PMpardom
01/10/2020, 7:08 PMJames Hilliard
01/11/2020, 1:49 AMCaused by: java.lang.AssertionError: Descriptor should be not null: ReactiveAuthenticationManagerResolver { request: ServerHttpRequest ->
if (request
.path
.subPath(0)
.value()
.startsWith("/employee")) {
return@label Mono.just(employeesAuthenticationManager())
}
Mono.just(customersAuthenticationManager())
}
at org.jetbrains.kotlin.codegen.ExpressionCodegen.getNonLocalReturnInfo(ExpressionCodegen.java:1674)
James Hilliard
01/11/2020, 1:49 AMe: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Failed to generate expression: KtBlockExpression
errorVlad
01/11/2020, 12:19 PMursus
01/11/2020, 12:27 PMivano
01/11/2020, 9:12 PMobject
to a lambda if and only if the object type is an interfaceivano
01/11/2020, 9:12 PMfun search(query: String) {
view?.showLoading()
repository.getRecipes(query, object : RepositoryCallback<List<Recipe>> {
override fun onSuccess(recipes: List<Recipe>?) {
<mailto:this@SearchResultsPresenter.recipes|this@SearchResultsPresenter.recipes> = recipes
if (recipes != null && recipes.isNotEmpty()) {
view?.showRecipes(recipes)
} else {
view?.showEmptyRecipes()
}
}
override fun onError() {
view?.showError()
}
})
}
ivano
01/11/2020, 9:13 PMgetRecipes
that has two parameters, I would put outside the second parameter transforming it as lambda but does not workHullaballoonatic
01/12/2020, 12:49 AMpavlospt
01/12/2020, 8:48 AMManuel Lorenzo
01/12/2020, 5:21 PMCzar
01/13/2020, 1:08 PMabstract class UnsignedRequest {
abstract fun signatureData(): String
fun <T : UnsignedRequest> sign(signer: (String) -> Signature): SignedRequest<T> =
SignedRequest(unsignedRequest = this as T, signature = signer(signatureData()))
}
data class SignedRequest<T : UnsignedRequest>(
@JsonUnwrapped val unsignedRequest: T,
val signature: Signature
}
Is there a way to make sign
method type-safe? I really don't like the unchecked cast to the type parameter: this as T
.
So far I came up with this, which is at least type safe, but repetitive, as I'm essentially copying the signing logic:
interface UnsignedRequest {
fun signatureData(): String
fun sign(signer: (String) -> Signature): SignedRequest<*>
}
data class SignedRequest<T : UnsignedRequest>(
@JsonUnwrapped val unsignedRequest: T,
val signature: Signature
}
data class ActualUnsignedRequest(/* properties */) {
override fun signatureData(): String = /* some composition of properties */
override fun sign(signer: (String) -> Signature) : SignedRequest<ActualUnsignedRequest> =
SignedRequest(req = this, signature = signatureData().let(signer))
}
UPDATE:
Silly me 😄 Forgot about extension functions' awesomeness!
inline fun <T : UnsignedRequest> T.sign(signer: (String) -> String): SignedRequest<T> =
SignedRequest(req = this, signature = signatureData().let(signer))
ESchouten
01/13/2020, 1:57 PMdave08
01/14/2020, 2:55 PMClockMark
from an existing time in milliseconds (a long value)?user
01/14/2020, 4:21 PMTristan
01/15/2020, 4:12 AMRobert
01/15/2020, 12:05 PMRobert
01/15/2020, 12:08 PMuser
01/15/2020, 3:42 PMSylvain Patenaude
01/15/2020, 5:09 PMsourceSets {
commonMain {
dependencies {
implementation kotlin("stdlib-common")
}
}
The warning is: 'kotlin' cannot be applied to '(java.lang.String)'
.
Posted in #gradleDarren Bell
01/16/2020, 9:15 AMaddamsson
01/16/2020, 9:46 AMDaniel Medeiros
01/16/2020, 6:52 PMMatthieu Stombellini
01/19/2020, 4:44 PMjames
01/19/2020, 10:32 PMsortedBy
and sortWith
if anyone can help? I want to provide a Comparator which compares two things, first being it is SomeType
and the second being (it as? SomeOtherType)?.stringField
I can see how to do this with two chained sort
functions, but I'd like to know how to do it with just one