Vampire
08/26/2020, 11:20 PMbjonnh
08/26/2020, 11:45 PMelect
08/27/2020, 9:22 AMkotlin.explicitApi()
to get explicit API mode enabled?reevn
08/27/2020, 9:47 AM1.4.0
the explicit kotlin-reflect
dependency is not needed anymore (in some situations?) as it's included in the standard runtime library?Fudge
08/27/2020, 11:29 AMCaused by: java.lang.NoSuchMethodError: kotlin.jvm.internal.FunctionReferenceImpl.<init>(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
thanksforallthefish
08/27/2020, 11:40 AMinspection.evaluations.map(::adapt)
fun adapt(evaluation: Evaluation) : EvaluationRepresentationApi
compiles with 1.3, but does not in 1.4 . inspection.evaluations.map { adapt(it) }
fixes it, but wanted to check if there is a different solution.
Sona Hovhannisyan
08/27/2020, 12:57 PMflatMap()
.
e: ../SomeClass.kt: Cannot choose among the following candidates without completing type inference:
public inline fun <T, R> Iterable<String!>.flatMap(transform: (String!) -> Iterable<???>): List<???> defined in kotlin.collections
public inline fun <T, R> Iterable<String!>.flatMap(transform: (String!) -> Sequence<???>): List<???> defined in kotlin.collections
e: ../SomeClass.kt: (158, 49): Unresolved reference: it
And the code to repro this issue
fun createStrings(strs: String): List<String> {
return emptyList<String>()
}
...
emptyList<String>().flatMap { createStrings(it) }
Anyone managed to fix this?Manit Chitkara
08/27/2020, 2:37 PMIaroslav Postovalov
08/27/2020, 3:13 PMsuspend (...) -> ...
?Joeywp
08/27/2020, 4:20 PMcompile "org.jetbrains.kotlin:kotlin-reflect:${versions.kotlin_version}"
(kotlin 1.4.0), it appears it doesn't fully include the reflection as methods like primaryConstructor
and declaredMemberProperties
can't be found. Am I doing something wrong? My jar size increases by 2mb though 🤔Gunslingor
08/27/2020, 4:21 PMAdam
08/27/2020, 5:31 PMInt
? I’m interested in seeing how mapping to int
, and boxing to java.lang.Integer
is implemented.
So far I found a Generator class: https://github.com/JetBrains/kotlin/blob/master/generators/builtins/primitives.kt
And this native generated file, but I can’t see an equivalent for JVM or where the conversion is handled.snowe
08/27/2020, 6:41 PMprivate String createObjectsWithRetry(final SObject... objects) {
...
id = crudService.createObjects(objects)[0];
...
}
whenever(crudService.createObjects(anyVararg())).thenReturn(listOf("a","b").toTypedArray())
whenever(crudService.createObjects(any<SObject>())).thenReturn(listOf("a","b").toTypedArray())
whenever(crudService.createObjects(any())).thenReturn(listOf("a","b").toTypedArray())
whenever(sfdcCrudService.createSfdcObjects(argThat{true})).thenReturn(listOf("a","b").toTypedArray())
...and more
The result is always null. I would expect all of these to work, but they do not. I cannot figure out what is wrong. It appears it has to do with how Java treats the varargs being passed as a param straight to a new method.andylamax
08/27/2020, 7:27 PM//case A
inline reified fun <T:Any?> T.doThing(name: String = T::class.simpleName ?: "") {}
or
//case B
inline reified fun <T:Any> T?.doThing(name: String = T::class.simpleName ?: "") {}
Luis Munoz
08/27/2020, 11:20 PMfun totalDistance(aList: List<Location>) : Double{
var total: Double = 0.0
for(x in 1..aList.size-1) {
total += distance(aList[x], aList[x-1])
}
return total
}
CodeIdeal
08/28/2020, 7:10 AMjanvladimirmostert
08/28/2020, 8:58 AMenum class Entity {
PROJECT, WORKSPACE, ...
enum class Access {
UPDATE, REMOVE, GRANT, ...
and i want to write an annotation
ProjectPermission("$PROJECT.$UPDATE", "$PROJECT.$READ")
@Repeatable
@MustBeDocumented
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.RUNTIME)
annotation class ProjectPermission(vararg val permission: String)
Problem is, the annotation requires a constant, is there a way to convert the String template containing the enums to a constant?
The other alternative is to write annotations @ProjectPermission(PROJECT, UPDATE)
, but i can only have one @ProjectPermission on my method with Runtime retention, so the string route allows for more permissionsNiranjan Kurve
08/28/2020, 10:35 AMRechee Jozil
08/28/2020, 4:46 PMpniederw
08/28/2020, 6:19 PMamadeu01
08/28/2020, 7:30 PMSlackbot
08/29/2020, 4:17 AMHullaballoonatic
08/29/2020, 7:43 PMa, b = b, a
the only place I can think of where commas are not enclosed in ()
is enum
classes. would that case alone cause python swap syntax to turn kotlin into an irregular language or something?
are free-range commas just too dangerous for future expansion? could they not use the same solution as in enum
and require a ;
for only the second time in the language, and thus open up all sorts of destructuring assignment, like that which you see in javascript?Nir
08/29/2020, 8:09 PM[
("carrot", ["orange"]),
("banana", ["green", "yellow", "black"]),
("lemon", ["green", "yellow"]),
("apple", ["red", "green"]),
]
to
{
'orange': ['carrot'],
'green': ['banana', 'lemon', 'apple'],
'yellow': ['banana', 'lemon'],
'black': ['banana'],
'red': ['apple']
}
I was able to get it but it's pretty ugly. I tried to think whether there's anything substantially nicer in kotlin, and I couldn't think of anything. Curious to see what folks come up with 🙂TwoClocks
08/29/2020, 11:01 PMfun time() = internalTime
vs val time = internalTime
?Kroppeb
08/30/2020, 10:45 AMReplaceWith()
for Deprecated
to help me. But I've noticed some issues.
Am I doing something wrong, or are ReplaceWith
not advanced enough (yet)?Sivan
08/31/2020, 8:03 AMKarlo Lozovina
08/31/2020, 11:25 AMvar f = fooMap["key"]
f = f+1
rrva
08/31/2020, 11:26 AMCLOVIS
08/31/2020, 1:17 PMval a by delegate1() and delegate2()
I'm expecting it to have to define
infix fun Delegate.and(other: Delegate): Delegate {...}
But since delegation is defined on the presence of methods, and not on the inheritance from an interface, I don't know how to do it :/