I'm writing Kotlin alongside java in an Android project, I have an abstract Java BaseApplication class which has some static methods, and my Application classes for each flavors extends this BaseApplication class (called App.kt) and are written in Kotlin. I wonder why I cant access BaseApplication static functions through App class in Kotlin code
public abstract class BaseApplication extends Application {
public static void staticFunction(){
Log.d("TAG", "some log...");
}
}
public class App : BaseApplication() {
fun doSomething(){
Log.w("TAG", "doing something")
}
I can call App.staticFunction() from a Java class but I cant call it from a Kotlin class. Am I doing something wrong? Why I can't call App.staticFunction() ? What is the difference?
I can do this from java:
public class JavaTest {
public void main(String[] args) {
App.staticFunction();
}
}
But this(kotlin) gives me compile error:
class KotlinTest {
fun main(args: Array<String>) {
App.staticFunction() //unresolved reference: static function
}
}
(I know I can access staticFunction through AbstractApplication, I just want to know why I cant access it through App class?)