mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
unchecked warning: argument type doesn't depend on call substitutor (IDEA-82605)
This commit is contained in:
+5
-2
@@ -24,7 +24,10 @@ import com.intellij.codeInsight.daemon.impl.quickfix.VariableArrayTypeFix;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.codeInsight.intention.QuickFixFactory;
|
||||
import com.intellij.codeInsight.quickfix.ChangeVariableTypeQuickFixProvider;
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.BaseJavaLocalInspectionTool;
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.util.Pass;
|
||||
@@ -248,7 +251,7 @@ public class UncheckedWarningLocalInspection extends BaseJavaLocalInspectionTool
|
||||
PsiParameter parameter = parameters[Math.min(i, parameters.length - 1)];
|
||||
final PsiExpression expression = expressions[i];
|
||||
final PsiType parameterType = substitutor.substitute(parameter.getType());
|
||||
final PsiType expressionType = substitutor.substitute(expression.getType());
|
||||
final PsiType expressionType = expression.getType();
|
||||
if (expressionType != null) {
|
||||
checkRawToGenericsAssignment(expression, parameterType, expressionType, true, myGenerifyFixes);
|
||||
}
|
||||
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
import java.util.*;
|
||||
class GenericsTest<T> {
|
||||
|
||||
static <S> S next(GenericsTest<S> test)
|
||||
{
|
||||
System.out.println(test);
|
||||
return null;
|
||||
}
|
||||
|
||||
public Iterator<T> iterator()
|
||||
{
|
||||
return new Iterator<T>() {
|
||||
@Override
|
||||
public boolean hasNext()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T next()
|
||||
{
|
||||
return GenericsTest.next(GenericsTest.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove()
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class GenericsTest1<T> {
|
||||
|
||||
static <S> S next1(GenericsTest1<S> test)
|
||||
{
|
||||
System.out.println(test);
|
||||
return null;
|
||||
}
|
||||
|
||||
public Iterator<T> iterator()
|
||||
{
|
||||
return new Iterator<T>() {
|
||||
@Override
|
||||
public boolean hasNext()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T next()
|
||||
{
|
||||
return GenericsTest1.next1(GenericsTest1.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove()
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class GenericsTest2<T> {
|
||||
|
||||
static <S> S next2(GenericsTest2<S> test)
|
||||
{
|
||||
System.out.println(test);
|
||||
return null;
|
||||
}
|
||||
|
||||
public Iterator<T> iterator()
|
||||
{
|
||||
return new Iterator<T>() {
|
||||
@Override
|
||||
public boolean hasNext()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T next()
|
||||
{
|
||||
return next2(GenericsTest2.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove()
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -119,6 +119,8 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testTypeParameterBoundVisibility() throws Exception { doTest(false);}
|
||||
public void testTypeParameterBoundVisibilityJdk14() throws Exception { doTest(false);}
|
||||
|
||||
public void testUncheckedWarningsLevel6() throws Exception { doTest(true);}
|
||||
|
||||
public void testJavaUtilCollections_NoVerify() throws Exception {
|
||||
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user