I have the following Java code I wanted to convert into Kotlin:
@Override
protected void finalize() throws Throwable {
try {
release();
} finally {
super.finalize();
}
}
In the official documentation I have found this:
protected fun finalize() {
// finalization logic
}
I use that like this:
protected fun finalize(){
try{
release()
}finally {
super.finalize() <--- But Android Studio does not recognize finalize()
}
}
Is it ok when I just delete super.finalize()? I have read the following SO threads but could not find a solution:
There is no
super.finalize()method to call because you are subclassingAny, notObject.Anydoesn't have afinalize()method. You wouldn't need to do this forObjectin Java either, because the base implementation doesn't do anything.