jameskleeh
02/02/2019, 7:01 AMsuper.method()
, but I keep getting unresolved reference. Any tips are appreciatedShawn
02/02/2019, 7:31 AMsuper.method()
should work fine normallyjameskleeh
02/02/2019, 7:31 AMjameskleeh
02/02/2019, 7:32 AMclass BindingSpec: AbstractRabbitMQTest({
val specName = javaClass.simpleName
given("A basic producer and consumer") {
jameskleeh
02/02/2019, 7:32 AMAbstractRabbitMQTest
jameskleeh
02/02/2019, 7:32 AMfun startContext(): ApplicationContext {
...
}
jameskleeh
02/02/2019, 7:32 AMjameskleeh
02/02/2019, 7:33 AMabstract class AbstractRabbitMQTest(body: AbstractBehaviorSpec.() -> Unit = {}): BehaviorSpec(body) {
Shawn
02/02/2019, 7:34 AMShawn
02/02/2019, 7:35 AMFoo.() -> Unit
-typed lambda isn’t actually anything special - it’s essentially a (Foo) -> Unit
but with this
in playShawn
02/02/2019, 7:36 AMsuper
instancejameskleeh
02/02/2019, 7:37 AMShawn
02/02/2019, 7:38 AMShawn
02/02/2019, 7:38 AMjameskleeh
02/02/2019, 7:43 AMShawn
02/02/2019, 7:44 AMjameskleeh
02/02/2019, 7:45 AMjameskleeh
02/02/2019, 7:45 AMShawn
02/02/2019, 7:45 AMjameskleeh
02/02/2019, 7:46 AMjameskleeh
02/02/2019, 7:46 AMShawn
02/02/2019, 7:46 AMShawn
02/02/2019, 7:49 AMjameskleeh
02/02/2019, 7:49 AMjameskleeh
02/02/2019, 7:50 AMShawn
02/02/2019, 7:50 AMjameskleeh
02/02/2019, 7:51 AMShawn
02/02/2019, 7:51 AMShawn
02/02/2019, 7:51 AMPavlo Liapota
02/02/2019, 8:39 AMabstract class Parent(
body: () -> Unit
) {
fun needToCall() { }
}
class Child : Parent {
constructor() : super({
super.needToCall()
})
}
As you can see error message is Cannot access '<this>' before superclass constructor has been called
. So it is not possible to do what you want.Pavlo Liapota
02/02/2019, 9:00 AMjameskleeh
02/02/2019, 1:28 PM