diamonds: copy throws list to static constructors to ensure correct unhandled exceptions, etc

This commit is contained in:
Anna Kozlova
2017-05-05 12:33:35 +03:00
parent cbe1434211
commit 7fcea68298
3 changed files with 18 additions and 0 deletions

View File

@@ -398,6 +398,7 @@ public class PsiDiamondTypeImpl extends PsiDiamondType {
return psiParameter.getType().getCanonicalText() + " p" + myIdx++;
}
}, ",")).append(")");
buf.append(constructor.getThrowsList().getText());
}
buf.append("{}");

View File

@@ -0,0 +1,13 @@
import java.io.IOException;
class MyTest<T> {
public MyTest() throws IOException {}
void m() {
MyTest<String> test = <error descr="Unhandled exception: java.io.IOException">new MyTest<>()</error>;
}
{
MyTest<String> test = new MyTest<>();
}
}

View File

@@ -89,6 +89,10 @@ public class Diamond8HighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testExceptionsThrownFromConstructorShouldBePreserved() throws Exception {
doTest();
}
public void testDiamondInsideOverloadedThisReference() throws Exception {
doTest();
}