unchecked warnings: don't check containing class parameters (IDEA-194678)

This commit is contained in:
Anna.Kozlova
2018-10-08 18:57:16 +02:00
parent 945c9bdc25
commit 291c5cb03b
3 changed files with 20 additions and 1 deletions
@@ -507,7 +507,7 @@ public class UncheckedWarningLocalInspection extends AbstractBaseJavaLocalInspec
final PsiSubstitutor substitutor = resolveResult.getSubstitutor();
if (!PsiUtil.isRawSubstitutor(method, substitutor)) {
if (JavaVersionService.getInstance().isAtLeast(place, JavaSdkVersion.JDK_1_8)) {
for (PsiTypeParameter parameter : PsiUtil.typeParametersIterable(method)) {
for (PsiTypeParameter parameter : method.getTypeParameters()) {
final PsiClassType[] extendsListTypes = parameter.getExtendsListTypes();
if (extendsListTypes.length > 0) {
final PsiType subst = substitutor.substitute(parameter);
@@ -0,0 +1,18 @@
abstract class Data<D extends Data<D,T>, T> {
private static <D extends Data<D,?>> double displayValue(D data) {
return data.getValue();
}
private final double value;
protected Data(T complement, double value) {
this.value = value;
}
public double getValue() {
return value;
}
}
@@ -44,6 +44,7 @@ public class LightAdvHighlightingJdk8Test extends LightDaemonAnalyzerTestCase {
public void testMethodReferences() { doTest(false, true); }
public void testUsedMethodsByMethodReferences() { enableInspectionTool(new UnusedDeclarationInspection()); doTest(true, true); }
public void testUncheckedWarningForPolyConditional() { enableInspectionTool(new UncheckedWarningLocalInspection()); doTest(true, true); }
public void testUncheckedWarningOnQualifierWithTypeParameterType() { enableInspectionTool(new UncheckedWarningLocalInspection()); doTest(true, true); }
public void testLambdaExpressions() { doTest(false, true); }
public void testUnsupportedFeatures() { doTest(false, false); }
public void testModulesNotSupported() { doTest(false, false); }