change signature: move declarations out of try/catch block (IDEA-169213)

This commit is contained in:
Anna.Kozlova
2017-03-07 14:57:35 +01:00
parent 2769981fb1
commit af59ff1487
5 changed files with 39 additions and 5 deletions
@@ -0,0 +1,8 @@
class Test {
int <caret>foo() throws IllegalArgumentException { return 1;}
void fooBar() throws IllegalArgumentException{
int a = foo();
System.out.println(a);
}
}
@@ -0,0 +1,13 @@
class Test {
int foo() throws Exception { return 1;}
void fooBar() throws IllegalArgumentException{
int a = 0;
try {
a = foo();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(a);
}
}
@@ -328,6 +328,15 @@ public class ChangeSignatureTest extends ChangeSignatureBaseTest {
);
}
public void testLessSpecificException() {
doTest(null, null, null, new SimpleParameterGen(new ParameterInfoImpl[0]),
method -> new ThrownExceptionInfo[]{
new JavaThrownExceptionInfo(0, myFactory.createTypeByFQClassName("java.lang.Exception", method.getResolveScope()))
},
false
);
}
public void testReorderWithVarargs() { // IDEADEV-26977
doTest(null, new ParameterInfoImpl[]{
new ParameterInfoImpl(1),