ziggy42
07/29/2017, 10:12 PMzak.taccardi
07/29/2017, 10:29 PMkarelpeeters
07/29/2017, 10:56 PMzak.taccardi
07/29/2017, 11:02 PMsamp
07/30/2017, 2:40 AMhandler: (MyDate) -> Unit
argument , how this works? Anybody has idea about it? Any source to learn more about this kind of arguments?
fun iterateOverDateRange(firstDate: MyDate, secondDate: MyDate, handler: (MyDate) -> Unit) {
for (date in firstDate..secondDate) {
handler(date)
}
}
jayjun
07/30/2017, 2:58 AM(MyDate) -> Unit
means a function that takes a MyDate
and returns nothing (Unit
). That is the type for the argument handler
.redrield
07/30/2017, 5:02 AMredrield
07/30/2017, 5:02 AMalexreidy
07/30/2017, 4:38 PMifActorThreadIsAvailable(action: (complete: () -> Unit) -> Unit)
And this works as expected. But when I call it through a non-inline function in the same class (no issues calling through another inline) it explodes: NoClassDefFoundError: mypkg/AbstractActor$ifActorThreadIsAvailable$1
.
The non-inline function contains a call like this ifActorThreadIsAvailable { complete -> ...
Does the $1
mean it's failing to find an internal anonymous lambda class or something? Thanksjkbbwr
07/30/2017, 6:38 PMalexreidy
07/30/2017, 7:16 PMziggy42
07/30/2017, 7:21 PM./gradlew run -q
ziggy42
07/30/2017, 7:21 PMScreenshot from 2017-07-30 21-17-47.png▾
ziggy42
07/30/2017, 7:21 PMkarelpeeters
07/30/2017, 7:22 PMziggy42
07/30/2017, 7:24 PMziggy42
07/30/2017, 7:25 PMkarelpeeters
07/30/2017, 7:27 PMkarelpeeters
07/30/2017, 7:28 PMziggy42
07/30/2017, 7:29 PMprint
is also wrong, since as you can see it puts a \n
that shouldn't be therekarelpeeters
07/30/2017, 7:29 PMkarelpeeters
07/30/2017, 7:30 PM./gradlew run -q
in Idea's terminal?ziggy42
07/30/2017, 7:32 PMziggy42
07/30/2017, 7:33 PMrun { standardInput = <http://System.in|System.in> }
to my build.gradle
ziggy42
07/30/2017, 7:36 PM-q
optionsziggy42
07/30/2017, 7:37 PMkarelpeeters
07/30/2017, 7:38 PMziggy42
07/30/2017, 7:39 PMalexreidy
07/30/2017, 8:02 PMException in thread "Thread-0" java.lang.NoClassDefFoundError: Bar$ifNotBusyPerform$1
at Bar.ifNotBusySayHello(IntegrationTest.kt:254)
at Bar$start$$inlined$synchronized$lambda$1.invoke(IntegrationTest.kt:207)
at Bar$start$$inlined$synchronized$lambda$1.invoke(IntegrationTest.kt:179)
at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:18)
Caused by: java.lang.ClassNotFoundException: Bar$ifNotBusyPerform$1
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
user
07/30/2017, 8:05 PM