mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
unchecked warning: don't warn for raw substitutor if parameter type mentions method's type parameter
GitOrigin-RevId: 8f0b56e55747ff36fffc6d60ae06bb4aea9fcd96
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6a68c1583a
commit
ebf02771d4
+4
-3
@@ -28,9 +28,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class UncheckedWarningLocalInspection extends AbstractBaseJavaLocalInspectionTool {
|
||||
@@ -524,7 +523,9 @@ public class UncheckedWarningLocalInspection extends AbstractBaseJavaLocalInspec
|
||||
final PsiParameter[] parameters = method.getParameterList().getParameters();
|
||||
for (final PsiParameter parameter : parameters) {
|
||||
final PsiType parameterType = parameter.getType();
|
||||
if (PsiTypesUtil.mentionsTypeParametersOrUnboundedWildcard(parameterType, substitutor.getSubstitutionMap().keySet(), true)) {
|
||||
Set<PsiTypeParameter> typeParameters = new HashSet<>(substitutor.getSubstitutionMap().keySet());
|
||||
Arrays.stream(method.getTypeParameters()).forEach(typeParameters::remove);
|
||||
if (PsiTypesUtil.mentionsTypeParametersOrUnboundedWildcard(parameterType, typeParameters, true)) {
|
||||
final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(method.getProject());
|
||||
PsiType type = elementFactory.createType(method.getContainingClass(), substitutor);
|
||||
return JavaErrorMessages.message("generics.unchecked.call.to.member.of.raw.type",
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
interface Predicate<<warning descr="Type parameter 'T' is never used">T</warning>> {}
|
||||
class Foo {
|
||||
static <C extends I> void process(Predicate<C> <warning descr="Parameter 'predicate' is never used">predicate</warning>, C <warning descr="Parameter 'context' is never used">context</warning>) {}
|
||||
}
|
||||
interface I {}
|
||||
class Bar implements I {
|
||||
Predicate p;
|
||||
{
|
||||
Foo.process(p, new Bar());
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -169,7 +169,7 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
public void testIntersectionTypeCast() { doTest(false, false); }
|
||||
public void testUsedMethodCalledViaReflectionInTheSameFile() { doTest(true, false); }
|
||||
public void testCatchSubclassOfThrownException() { doTest(true, false); }
|
||||
|
||||
public void testNoUncheckedWarningOnRawSubstitutor() { doTest(true, false); }
|
||||
public void testArrayInitializerTypeCheckVariableType() { doTest(false, false);}
|
||||
|
||||
public void testJavaUtilCollections_NoVerify() {
|
||||
|
||||
Reference in New Issue
Block a user