[Tests] Remove temporary directories check from finalize

This implementation of `finalize()` is incorrect. See: https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html#finalize()

> If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

> If a subclass overrides finalize it must invoke the superclass finalizer explicitly.

Instead of providing help by highlighting the tests that forget to clear the temporary directories, this `finalize()` causes OOM.

Merge-request: KT-MR-10756
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
This commit is contained in:
Nikolay Lunyak
2023-06-22 11:43:21 +00:00
committed by Space Team
parent 0e51a00871
commit f4f9f1f8f8
@@ -47,13 +47,6 @@ class TemporaryDirectoryManagerImpl(testServices: TestServices) : TemporaryDirec
}
}
@Suppress("removal")
fun finalize() {
if (rootTempDir.isInitialized() && rootDir.exists()) {
error("The temporary directory $rootDir has not been deleted by the time the corresponding ${this::class.simpleName} is finalized.")
}
}
companion object {
private val onWindows: Boolean = System.getProperty("os.name").lowercase(Locale.getDefault()).contains("windows")