apatrida
01/28/2016, 9:55 PMapatrida
01/28/2016, 10:08 PM1.12.0-RC-1017
Klutter 0.13-RC-1017
Jackson Kotlin Module 2.5.5-RC-1017
, 2.6.5-RC-1017
and 2.7.0-RC-1017
Kovert 0.10-RC-1017
For any of these you need this repo added to your build until we are allowed to publish on maven central:
repositories {
maven {
url "<http://dl.bintray.com/jaysonminard/kohesive>"
}
}
And for:
Kovenant library, version 3.0.0-rc.01017
with this repo:
repositories {
maven {
url "<http://dl.bintray.com/mplatvoet/komponents>"
}
}
apatrida
01/28/2016, 10:24 PMapatrida
01/28/2016, 10:24 PMapatrida
01/28/2016, 10:25 PMapatrida
01/28/2016, 10:52 PMprivate val people = hashMapOf(*listOf(
Person(1, "Frank", 30),
Person(2, "Domingo", 19),
Person(3, "Mariana", 22),
Person(4, "Lucia", 31)
).map { it.id to it }.toTypedArray())
Warning:(169, 27) Kotlin: It may be not safe to use 'kotlin.Pair<kotlin.Int, uy.kohesive.kovert.vertx.boot.test.Person>' as an argument for a reified type parameter. Use a non-generic type or * if possibleI added this to https://youtrack.jetbrains.com/issue/KT-10847
apatrida
01/28/2016, 11:04 PMtoTypedArray()
causing it on many things. And I know this is odd code because when modernized to the following, no warning:
private val people = listOf(
Person(1, "Frank", 30),
Person(2, "Domingo", 19),
Person(3, "Mariana", 22),
Person(4, "Lucia", 31)
).associateByTo(HashMap()) { it.id }
but this makes the warning:
val x = listOf(1,2,3).map { it to it * 4 }.toTypedArray()
vmironov
01/28/2016, 11:10 PMforEach
issue was fixed?vmironov
01/28/2016, 11:11 PMComparator.reversed()
methodvmironov
01/28/2016, 11:11 PMilya.gorbunov
01/28/2016, 11:12 PMComparator.reversed
? Either with member or with extension you get the reversed comparator.apatrida
01/28/2016, 11:14 PMvmironov
01/28/2016, 11:18 PMfun main(args: Array<String>) {
arrayListOf("hello", "world").forEach {
println(it)
}
String.CASE_INSENSITIVE_ORDER.reversed()
}
compiles to
Compiled from "Main.kt"
public final class com.github.vmironov.MainKt {
public static final void main(java.lang.String[]);
Code:
0: aload_0
1: ldc #9 // String args
3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkParameterIsNotNull:(Ljava/lang/Object;Ljava/lang/String;)V
6: iconst_2
7: anewarray #17 // class java/lang/String
10: dup
11: iconst_0
12: ldc #19 // String hello
14: aastore
15: dup
16: iconst_1
17: ldc #21 // String world
19: aastore
20: invokestatic #27 // Method kotlin/collections/CollectionsKt.arrayListOf:([Ljava/lang/Object;)Ljava/util/ArrayList;
23: checkcast #29 // class java/lang/Iterable
26: astore_1
27: nop
28: aload_1
29: invokeinterface #33, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
34: astore_2
35: aload_2
36: invokeinterface #39, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z
41: ifeq 69
44: aload_2
45: invokeinterface #43, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
50: astore_3
51: aload_3
52: checkcast #17 // class java/lang/String
55: astore 4
57: aload 4
59: invokestatic #49 // Method kotlin/io/ConsoleKt.println:(Ljava/lang/Object;)V
62: getstatic #55 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
65: pop
66: goto 35
69: getstatic #60 // Field kotlin/jvm/internal/StringCompanionObject.INSTANCE:Lkotlin/jvm/internal/StringCompanionObject;
72: invokestatic #66 // Method kotlin/text/StringsKt.getCASE_INSENSITIVE_ORDER:(Lkotlin/jvm/internal/StringCompanionObject;)Ljava/util/Comparator;
75: invokeinterface #72, 1 // InterfaceMethod java/util/Comparator.reversed:()Ljava/util/Comparator;
80: pop
81: return
}
in case of forEach
call extension method takes precedence over instance method, but in case of reversed
the instance method is usedvmironov
01/28/2016, 11:19 PMjava/util/Comparator.reversed
method in java 6ilya.gorbunov
01/28/2016, 11:21 PMvmironov
01/28/2016, 11:24 PMJDK7
or JDK8
vmironov
01/28/2016, 11:24 PMvmironov
01/28/2016, 11:25 PMilya.gorbunov
01/28/2016, 11:25 PMvmironov
01/28/2016, 11:27 PMvmironov
01/29/2016, 12:52 AMkapt
is the one to blamevmironov
01/29/2016, 12:53 AMvmironov
01/29/2016, 2:29 AMComparator.reversed
method. sample-good
works fines, sample-bad
crashes with java.lang.NoSuchMethodError: No interface method reversed()Ljava/util/Comparator
. The only difference between these two apps is that sample-bad
uses kapt
and sample-good
doesn't.benny_wang
01/29/2016, 3:10 AMbenny_wang
01/29/2016, 3:11 AMbenny_wang
01/29/2016, 3:12 AMbenny_wang
01/29/2016, 3:29 AMbenny_wang
01/29/2016, 6:11 AMbenny_wang
01/29/2016, 6:34 AMandrewoma
01/29/2016, 6:56 AMby