mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
correctly check for super call in constructor (IDEA-97203)
This commit is contained in:
+1
-1
@@ -244,7 +244,7 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
|
||||
|
||||
if (toCatchExceptions) {
|
||||
if (!(ref instanceof PsiReferenceExpression &&
|
||||
((PsiReferenceExpression)ref).getQualifierExpression() instanceof PsiSuperExpression)) {
|
||||
RefactoringUtil.isSuperOrThisCall(PsiTreeUtil.getParentOfType(ref, PsiStatement.class), true, false))) {
|
||||
if (needToCatchExceptions(changeInfo, caller)) {
|
||||
PsiClassType[] newExceptions =
|
||||
callee != null ? getCalleeChangedExceptionInfo(callee) : getPrimaryChangedExceptionInfo(changeInfo);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
class Base {
|
||||
public B<caret>ase() {
|
||||
}
|
||||
}
|
||||
|
||||
class AAA extends Base {
|
||||
public AAA() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import java.io.IOException;
|
||||
|
||||
class Base {
|
||||
public Base() throws IOException {
|
||||
}
|
||||
}
|
||||
|
||||
class AAA extends Base {
|
||||
public AAA() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -251,6 +251,19 @@ public class ChangeSignatureTest extends LightRefactoringTestCase {
|
||||
false);
|
||||
}
|
||||
|
||||
public void testConstructorException() throws Exception {
|
||||
doTest(null, null, null, new SimpleParameterGen(new ParameterInfoImpl[0]),
|
||||
new GenExceptions() {
|
||||
@Override
|
||||
public ThrownExceptionInfo[] genExceptions(PsiMethod method) {
|
||||
return new ThrownExceptionInfo[] {
|
||||
new JavaThrownExceptionInfo(-1, JavaPsiFacade.getInstance(method.getProject()).getElementFactory().createTypeByFQClassName("java.io.IOException", method.getResolveScope()))
|
||||
};
|
||||
}
|
||||
},
|
||||
false);
|
||||
}
|
||||
|
||||
public void testAddRuntimeException() throws Exception {
|
||||
doTest(null, null, null, new SimpleParameterGen(new ParameterInfoImpl[0]),
|
||||
new GenExceptions() {
|
||||
|
||||
Reference in New Issue
Block a user