mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-111613 Bad code is green: IDEA doesn't show 'Unhandled exception' error when a method with parametrized 'throws' section is used with wildcard type argument
This commit is contained in:
@@ -541,7 +541,7 @@ public class ExceptionUtil {
|
||||
List<PsiClassType> result = ContainerUtil.newArrayList();
|
||||
|
||||
for (PsiClassType referencedType : referencedTypes) {
|
||||
final PsiType type = substitutor.substitute(referencedType);
|
||||
final PsiType type = GenericsUtil.eliminateWildcards(substitutor.substitute(referencedType), false);
|
||||
if (!(type instanceof PsiClassType)) continue;
|
||||
PsiClassType classType = (PsiClassType)type;
|
||||
PsiClass exceptionClass = ((PsiClassType)type).resolve();
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
interface I<T extends Exception> {
|
||||
void m() throws T;
|
||||
}
|
||||
|
||||
class C {
|
||||
void x(I<?> i) {
|
||||
<error descr="Unhandled exception: java.lang.Exception">i.m();</error>
|
||||
}
|
||||
|
||||
void y(I<? extends Exception> i) {
|
||||
<error descr="Unhandled exception: java.lang.Exception">i.m();</error>
|
||||
}
|
||||
}
|
||||
+1
@@ -58,4 +58,5 @@ public class LightAdvHighlightingJdk6Test extends LightDaemonAnalyzerTestCase {
|
||||
public void testClassObjectAccessibility() throws Exception { setLanguageLevel(LanguageLevel.JDK_1_6); doTest(false, false); }
|
||||
public void testRedundantCastInConditionalExpression() throws Exception { setLanguageLevel(LanguageLevel.JDK_1_6); doTest(true, false); }
|
||||
public void testJava5CastConventions() { setLanguageLevel(LanguageLevel.JDK_1_5); doTest(true, false); }
|
||||
public void testUnhandledExceptions() { doTest(true, false); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user