What is the Kotlin Java equivalent OuterClass.super.method()?
OuterClass.super.method()
Example (in Java):
class Outer { class Inner { void someMethod() { Outer.super.someOtherMethod(); } } @Override public String someOtherMethod() { // This is not called... } }
Use the syntax super@OuterClass.method():
super@OuterClass.method()
open class C { open fun f() { println("C.f()") } } class D : C() { override fun f() { println("D.f()") } inner class X { fun g() { super@D.f() // <- here } } }
This is similar to how Java OuterClass.this expresses itself in Kotlin asthis@OuterClass .
OuterClass.this
this@OuterClass
This would be equivalent in Kotlin:
internal class Outer { internal inner class Inner { fun myMethod() { println(super@Outer.toString()) } } override fun toString(): String { return "Blah" } }
Source: https://habr.com/ru/post/1682496/More articles:Bokeh + Flask: multiple AjaxDataSource calls - pythonJava 8 Optional instead of if - javaError TS-2304 - Cannot find the name "Iterable" in TypeScript when importing "jquery" into the ".ts" file - jqueryHow to dynamically calculate sums of many columns in GROUP? - sqlFind value in binary tree avoiding stackoverflow exception - javajobcheduler: how to transfer a task after its completion? - androidHigh number of execution requests for each block block being viewed - pythonAzure AD B2C с настраиваемыми политиками: невозможно аутентифицировать пользователя с временным паролем - azure-ad-b2cDocker cannot find file when creating image - pythonUsing the "Logging" Setup Method SetupSet - c #All Articles