bbaldino
07/17/2019, 8:19 PMbbaldino
07/17/2019, 8:23 PMsam
07/17/2019, 8:24 PMbbaldino
07/17/2019, 8:25 PMbbaldino
07/17/2019, 8:34 PMbbaldino
07/17/2019, 8:35 PMabstract class Foo<T, U>(
val lambda: (T) -> Boolean
) {
abstract fun fun1(key: T, value: U)
}
bbaldino
07/17/2019, 8:35 PMclass FooTest : ShouldSpec() {
override fun isolationMode(): IsolationMode? = IsolationMode.InstancePerLeaf
private val keyChanges = mutableListOf<Pair<Int, String?>>()
private val map: Int = 1.apply {
object : Foo<Int, String>({ it == 1}) {
override fun fun1(key: Int, value: String) {
keyChanges.add(key to value)
}
}
}
init {
}
}
bbaldino
07/17/2019, 8:35 PMWARNING: TestEngine with ID 'kotlintest' failed to discover tests
java.lang.VerifyError: Call to wrong <init> method
Exception Details:
Location:
org/jitsi/nlj/util/FooTest.<init>()V @49: invokespecial
Reason:
Type 'org/jitsi/nlj/util/FooTest$map$1$1' (constant pool 35) is not assignable to 'org/jitsi/nlj/util/FooTest$$special$$inlined$apply$lambda$1' (constant pool 48)
Bytecode:
0x0000000: 2a01 0401 b700 192a 3a04 bb00 1b59 b700
0x0000010: 1dc0 001f 3a05 1904 1905 b500 212a 043c
0x0000020: 3a04 1b3d 033e bb00 2359 b200 29c0 002b
0x0000030: 2ab7 0030 5700 1b36 0519 0415 05b5 0032
0x0000040: b1
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at io.kotlintest.runner.jvm.TestDiscovery.loadClasses(TestDiscovery.kt:118)
at io.kotlintest.runner.jvm.TestDiscovery.discover(TestDiscovery.kt:44)
at io.kotlintest.runner.junit5.KotlinTestEngine.discover(KotlinTestEngine.kt:68)
at io.kotlintest.runner.junit5.KotlinTestEngine.discover(KotlinTestEngine.kt:28)
at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:177)
at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:164)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
bbaldino
07/17/2019, 8:36 PMkeyChanges.add(key to value)
will make it go awaybbaldino
07/17/2019, 8:36 PMsam
07/17/2019, 8:41 PMbbaldino
07/17/2019, 8:41 PMbbaldino
07/17/2019, 8:42 PMsam
07/17/2019, 8:42 PMbbaldino
07/17/2019, 8:42 PMbbaldino
07/17/2019, 8:43 PMsam
07/17/2019, 8:46 PMbbaldino
07/17/2019, 8:46 PMsam
07/17/2019, 8:46 PMsam
07/17/2019, 8:46 PMsam
07/17/2019, 8:47 PMbbaldino
07/17/2019, 8:53 PMval x = Class.forName("org.jitsi.nlj.util.FooTest").kotlin
inside a scratch and that errors as wellbbaldino
07/17/2019, 8:54 PMsam
07/17/2019, 8:55 PMbbaldino
07/17/2019, 8:56 PMsam
07/17/2019, 8:56 PMbbaldino
07/17/2019, 8:57 PMsam
07/17/2019, 8:57 PMsam
07/17/2019, 8:57 PMbbaldino
07/17/2019, 8:57 PMsam
07/17/2019, 8:58 PMfun main() {
val x = Class.forName("org.jitsi.nlj.util.FooTest")
println(x)
}
sam
07/17/2019, 8:58 PMbbaldino
07/17/2019, 8:58 PMsam
07/17/2019, 8:58 PMbbaldino
07/17/2019, 8:58 PMException in thread "main" java.lang.VerifyError: Call to wrong <init> method
Exception Details:
Location:
org/jitsi/nlj/util/FooTest.<init>()V @49: invokespecial
Reason:
Type 'org/jitsi/nlj/util/FooTest$map$1$1' (constant pool 35) is not assignable to 'org/jitsi/nlj/util/FooTest$$special$$inlined$apply$lambda$1' (constant pool 48)
Bytecode:
0x0000000: 2a01 0401 b700 192a 3a04 bb00 1b59 b700
0x0000010: 1dc0 001f 3a05 1904 1905 b500 212a 043c
0x0000020: 3a04 1b3d 033e bb00 2359 b200 29c0 002b
0x0000030: 2ab7 0030 5700 1b36 0519 0415 05b5 0032
0x0000040: b1
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.jitsi.nlj.util.TempKt.main(Temp.kt:20)
at org.jitsi.nlj.util.TempKt.main(Temp.kt)
sam
07/17/2019, 8:59 PMsam
07/17/2019, 8:59 PMbbaldino
07/17/2019, 8:59 PMinline
if that's what you mean?sam
07/17/2019, 8:59 PMsam
07/17/2019, 8:59 PMbbaldino
07/17/2019, 9:00 PMsam
07/17/2019, 9:01 PMbbaldino
07/17/2019, 9:01 PMbbaldino
07/17/2019, 9:05 PMbbaldino
07/17/2019, 9:05 PMclass FooTest : ShouldSpec() {
override fun isolationMode(): IsolationMode? = IsolationMode.InstancePerLeaf
private val num = 42
private val map: Int = 1.apply {
object : Foo<Int, String>({ it == 1}) {
override fun fun1(key: Int, value: String) {
println(num)
}
}
}
init {
}
}
sam
07/17/2019, 9:05 PMwasyl
07/17/2019, 9:33 PMwasyl
07/17/2019, 9:34 PMsam
07/17/2019, 9:35 PMwasyl
07/17/2019, 9:35 PMsam
07/17/2019, 9:36 PMsam
07/17/2019, 9:36 PMbbaldino
07/18/2019, 3:43 AMsam
07/18/2019, 3:48 AMsam
07/18/2019, 3:48 AMfun main() {
Class.forName("com.sksamuel.kotlintest.FooTest")
}
class FooTest {
val num = 42
private val map: Int = 1.apply {
object : Foo({ it == 1 }) {
override fun fun1() {
println(num)
}
}
}
init {
}
}
abstract class Foo(
val lambda: (Any) -> Boolean
) {
abstract fun fun1()
}
sam
07/18/2019, 3:48 AMsam
07/18/2019, 3:54 AMsam
07/18/2019, 3:54 AMfun main() {
Class.forName("a.b.c.X")
}
class X {
val num = 42
val map: Int = 1.apply {
object : Y({ true }) {
override fun fun1() {
println(num)
}
}
}
}
abstract class Y(val lambda: () -> Boolean) {
abstract fun fun1()
}
bbaldino
07/18/2019, 3:55 AMsam
07/18/2019, 3:57 AMsam
07/18/2019, 3:57 AMbbaldino
07/18/2019, 3:57 AMsam
07/18/2019, 3:57 AM