Vinicius Araujo
10/12/2019, 2:12 PMinit
blocks are not executed in casts right? Is there a way I could achieve it?Marko Mitic
10/12/2019, 8:02 PM@Binds
). So far, I can make it work with Kotlin types and even Java ones but it fails for generic Java types (like List<*> and ArrayList<*>). Is this limitation of generics system or am I doing something wrong?
function: fun <C : I, I: Any> bind(clazz: Class<C>, iface: Class<I>)
usage: bind(ArrayList::class.java, List::class.java) //kotlin types, works fine
bind(java.util.ArrayList::class.java, java.util.List::class.java) // error: inferred type ArrayList<*> is not a subtype of List<*>
Felipe Álvarez
10/12/2019, 8:52 PMdata class
as the class to be deserialized and I need to transform a JSON value into a custom object. For instance, a String
value from JSON gets transformed into an enum
value in my app, or color String
into an Int
. In Java, what I did was doing the transformation in the setter of the field.
In Kotlin, it seems like Jackson uses the generated constructor for deserializing instead of getters and setters, so I end up having a InvalidFormatException
because it cannot construct an instance of T type from some R type.
BTW, I'm using KotlinModule
in my ObjectParser
Is there an elegant solution to this? Or this is not a good use case for data classes?
A not so elegant solution I found was defining in my constructor a var
of my "transformed" type and then a function set<jsonFieldName>
that Jackson uses because it JSON field name and constructor field name don't matchgroostav
10/12/2019, 9:46 PMkotlin.Pair
vs javafx.util.Pair
. Can these inspections be updated to detect error messages like "expected List<ASDF> but was List<ASDF>"... oh, expected == actual, => fully qualify them => "expected List<com.yourcompany.ASDF> but was List<somebody.else.ASDF>"
Maybe this can should be my first PR against the kotlin plugin repo?pavi2410
10/12/2019, 10:55 PMmix
variable)LastExceed
10/13/2019, 7:39 AMkarelpeeters
10/13/2019, 6:34 PMother@Outer.x
here but I can't figure out the syntax:
class Outer(val x: Int) {
inner class Inner {
fun foo(other: Inner): Int = this@Outer.x + other@Outer.x
}
}
Paul Dhaliwal
10/13/2019, 9:06 PMIfvwm
10/14/2019, 5:53 AMsealed class Fix<F>
data class MkFix<F> (val x: F<Fix<F>>): Fix<F>()
this is possible?Andreas Unterweger
10/14/2019, 11:18 AMbitkid
10/14/2019, 12:35 PMjmfayard
10/14/2019, 4:53 PMAshutosh Panda
10/14/2019, 5:13 PMvar nullTest:Int?=null
if(nullTest!=null)
nullTest=1
else
nullTest=0
println(nullTest)
Ashutosh Panda
10/14/2019, 5:16 PMvar nullTest:Int?=null
nullTest?println("1"):println("0")
standinga
10/14/2019, 8:42 PMnkiesel
10/14/2019, 11:01 PMapplyBindings()
(a normal method of that builder) must be called before it's passed on. We currently do that manually, but this of course leads to bugs where this call was forgotten.jojo.lichtenberger
10/15/2019, 7:32 AMPrateek Grover
10/15/2019, 7:39 AMMaxim Kizub
10/15/2019, 7:49 AMSlackbot
10/15/2019, 8:13 AMthana
10/15/2019, 9:28 AM::propertyName
resolves to the method, not the propertyStephan Schroeder
10/15/2019, 11:01 AMaballano
10/15/2019, 12:42 PMfactory kotlinx.atomicfu.AtomicFU::atomic is used outside of constructor or class initialisation
I'm just using them in local functions mainly, is this not permitted? if so, is there an alternative usage to do so? Thanks in advance! cc @elizarovStephan Schroeder
10/15/2019, 1:19 PMCzar
10/15/2019, 2:19 PMclass DoSomethingCommand : Command
in DoSomethingCommand.kt and class DoSomethingCommandHandler : CommandHandler<DoSomethingCommand, R>
in DoSomethingCommandHandler.kt
2️⃣ same as above but in one file, e.g. DoSomething.kt
3️⃣ Command handler is an inner class of the command: class DoSomethingCommand : Command { class DoSomethingCommandHandler : CommandHandler<DoSomethingCommand, R> }
If that matters, command dispatcher is used, so handlers are only addressed directly in tests, otherwise it's commandInstance.execute()
where fun Command.execute() = /* get command dispatcher from static context and dispatch the command */
veesus mikel heir
10/15/2019, 4:33 PMtrevjones
10/15/2019, 6:42 PMMani
10/15/2019, 8:20 PMtaer
10/15/2019, 9:20 PMversion
I convert that into a wonderful inline class. I get all sorts of wonderful compile errors which I fix. However, this didn't pop up on the radar val versionTag = "ver-$version"
As a String, this worked wonderfully. As an inline class, this ends up with the type name in the rendered String.
I overrode toString()
to handle this. I could have used the val
from the inline class in the template as well. Either are valid solutions. I'm more worried about accidental usages in the future.
Any thoughts as to making inline classes use in string templates a potential compile warning? Or something similar?Robert Jaros
10/15/2019, 9:58 PMRobert Jaros
10/15/2019, 9:58 PMFoso
10/16/2019, 4:52 AM