In Java, a try { ... } finally { ... } is executed somewhat unintuitively to me. As illustrated in another question, Does finally always execute in Java?, if you have a retu
If you call javac with -Xlint, then an appropriate warning will be generated indicating that you should not call return from a finally clause. For example (compiling a simple class with the above test()
method):
javac -Xlint foo.java
foo.java:13: warning: [finally] finally clause cannot complete normally
}
^
1 warning