y
10/12/2023, 4:49 PMsynchronized
block?ephemient
10/12/2023, 4:54 PMy
10/12/2023, 4:55 PMephemient
10/12/2023, 4:55 PMtry {
MONITORENTER
block()
} finally {
MONITOREXIT
}
(you can't write those bytecode instructions in pure Kotlin but the compiler can)y
10/12/2023, 4:57 PMJoffrey
10/13/2023, 8:13 AMfinally
block always executes, whether the try
block completed normally or threw an exception. You can read about try
-catch
-finally
constructs in this section of the Java documentation:
https://docs.oracle.com/javase/tutorial/essential/exceptions/handling.html
And more specifically about `finally`:
https://docs.oracle.com/javase/tutorial/essential/exceptions/finally.html