Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

@SneakyThrows causes incorrect errors in IntelliJ 14 #101

Closed
rick-kilgore opened this issue Apr 17, 2015 · 1 comment
Closed

@SneakyThrows causes incorrect errors in IntelliJ 14 #101

rick-kilgore opened this issue Apr 17, 2015 · 1 comment
Assignees
Labels
Milestone

Comments

@rick-kilgore
Copy link

I haven't been able to update my lombok plugin for several versions, because every time I do, it incorrectly marks catch clauses as impossible. Here is an example that captures the gist of what my code looks like:

@SneakyThrows
private void hideIt() {
    try {
        itThrows(true);
    } catch (IOException e) {   // <=== IntelliJ flags this catch as an error
        e.printStackTrace();
    }
}

private void itThrows(boolean foo) throws Exception {
    if (foo) {
        throw new IOException("test");
    } else {
        throw new Exception("test2");
    }
}

Since somewhere around plugin version 0.9.0, IntelliJ marks the catch in itThrows() as impossible ("Exception 'java.io.IOException' is never thrown in the corresponding try block"). But it is clearly possible, and javac is fine with this code. If I remove the @SneakyThrows annotation on hideIt(), the error goes away (and it complains that I need to catch or declare Exception).

@mplushnikov mplushnikov added this to the 0.9.3 milestone Apr 26, 2015
@mplushnikov mplushnikov self-assigned this Apr 26, 2015
@mplushnikov
Copy link
Owner

Should be fixed in the next release 0.9.3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants