method applicability: do not check erased types if method was not called on raw type (IDEA-104992)

This commit is contained in:
anna
2013-04-24 14:14:49 +02:00
parent 7219191352
commit 3433d392a3
3 changed files with 20 additions and 1 deletions
@@ -466,7 +466,8 @@ public final class PsiUtil extends PsiUtilCore {
final PsiParameter[] parms = method.getParameterList().getParameters();
if (args.length < parms.length - 1) return ApplicabilityLevel.NOT_APPLICABLE;
final boolean isRaw = isRawSubstitutor(method, substitutorForMethod);
final PsiClass containingClass = method.getContainingClass();
final boolean isRaw = containingClass != null && isRawSubstitutor(containingClass, substitutorForMethod);
if (!areFirstArgumentsApplicable(args, parms, languageLevel, substitutorForMethod, isRaw)) return ApplicabilityLevel.NOT_APPLICABLE;
if (args.length == parms.length) {
if (parms.length == 0) return ApplicabilityLevel.FIXED_ARITY;
@@ -0,0 +1,17 @@
import java.util.Collection;
import java.util.Set;
class FooObject<T> {}
class FooId<T extends FooObject> {}
interface Bar {
<T extends FooObject, I extends FooId<? extends T>> T get(I key);
<T extends FooObject, I extends FooId<? extends T>> Collection<T> get(Collection<I> keys);
}
public class Target {
void foo(Bar bar) {
final Set<FooId<?>> keys = null;
final Collection<FooObject> values = bar.get(keys);
}
}
@@ -207,6 +207,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testIDEA103760(){ doTest5(false); }
public void testIDEA105846(){ doTest5(false); }
public void testIDEA105695(){ doTest5(false); }
public void testIDEA104992(){ doTest5(false); }
public void testWildcardsOnRawTypes() { doTest5(false); }
public void testDisableWithinBoundsCheckForSuperWildcards() {