Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with exception type mismatches between the source and target methods #43

Open
khatchad opened this issue Jan 6, 2016 · 1 comment

Comments

@khatchad
Copy link
Member

khatchad commented Jan 6, 2016

Consider the following valid input source code:

package p;

import java.io.IOException;

interface I {
    void m() throws Exception;
}

abstract class A implements I {
    public void m() throws IOException {
    }

    void n() throws IOException {
        m();
    }

    void q(I i) throws Exception {
        i.m();
    }
}

Suppose that A.m() is the source method. In migrating it to I, we now have a mismatch between the exception types thrown. Specifically, I.m() declares that it throws Exception, while A.m() declares that it throws IOException. In fact, picking either of these exception types for the target method would result in an error.

There are two issues here, I believe. First, we should not allow exception type mismatches (will create a new issue for this). Second, we need an issue to possibly relax this precondition. In the above situation, there's just nothing we can do. However, using intra-procedural analysis, it is possible to see which exception type to pick.

@khatchad
Copy link
Member Author

I believe we do have a check for the basic case mentioned above. Looks like this issue is for the relaxation.

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

No branches or pull requests

1 participant