do not create throws list without exceptions (IDEA-65790 )

This commit is contained in:
anna
2011-02-27 19:30:02 +01:00
parent e68c92c49f
commit 701d391f3d
4 changed files with 16 additions and 1 deletions
@@ -402,7 +402,10 @@ public class PsiElementFactoryImpl extends PsiJavaParserFacadeImpl implements Ps
public PsiReferenceList createReferenceList(@NotNull final PsiJavaCodeReferenceElement[] references) throws IncorrectOperationException {
final StringBuilder builder = StringBuilderSpinAllocator.alloc();
try {
builder.append("void method() throws ");
builder.append("void method()");
if (references.length > 0){
builder.append(" throws ");
}
for (int i = 0; i < references.length; i++) {
if (i > 0) builder.append(", ");
builder.append(references[i].getCanonicalText());
@@ -0,0 +1,4 @@
class Test {
void fo<caret>o() throws RuntimeException {
}
}
@@ -0,0 +1,4 @@
class Test {
void foo() {
}
}
@@ -288,6 +288,10 @@ public class ChangeSignatureTest extends LightCodeInsightTestCase {
doTest(null, null, "Exception", new SimpleParameterGen(), new SimpleExceptionsGen(), false);
}
public void testRemoveExceptions() throws Exception {
doTest(null, null, "void", new SimpleParameterGen(), new SimpleExceptionsGen(), false);
}
private void doTest(String newReturnType, ParameterInfoImpl[] parameterInfos, final boolean generateDelegate) throws Exception {
doTest(null, null, newReturnType, parameterInfos, new ThrownExceptionInfo[0], generateDelegate);
}