remove return statement from it. Final block is considered to be cleanup block, return is not generally expected in it.


The return from finally "overrides" further exception throwing.

public class App {
    public static void main(String[] args) {
        System.err.println(f());
    }
    public static int f() {
        try {
            throw new RuntimeException();
        } finally {
            return 1;
        }
    }
}

1