mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
do not infer from wildcard with raw bound (IDEA-110947)
This commit is contained in:
@@ -522,7 +522,13 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
|
||||
private static Pair<PsiType, ConstraintType> processArgType(PsiType arg, final ConstraintType constraintType,
|
||||
final boolean captureWildcard) {
|
||||
if (arg instanceof PsiWildcardType && !captureWildcard) return FAILED_INFERENCE;
|
||||
if (arg != PsiType.NULL) return new Pair<PsiType, ConstraintType>(arg, constraintType);
|
||||
if (arg != PsiType.NULL) {
|
||||
if (arg instanceof PsiWildcardType) {
|
||||
final PsiType bound = ((PsiWildcardType)arg).getBound();
|
||||
if (bound instanceof PsiClassType && ((PsiClassType)bound).isRaw()) return Pair.create(null, constraintType);
|
||||
}
|
||||
return new Pair<PsiType, ConstraintType>(arg, constraintType);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
interface Result {}
|
||||
|
||||
interface Command<R extends Result> {}
|
||||
|
||||
interface Procedure<C extends Command<Result>> {
|
||||
}
|
||||
|
||||
abstract class ProcedureService {
|
||||
abstract <C extends Command<Result>> Class<? extends Procedure<Command<Result>>> getProcedure(Class<C> cmd);
|
||||
|
||||
public <C extends Command<Result>> void execute(Class<? extends Command> aClass) {
|
||||
Class<Procedure<Command<Result>>> procedureClass = getProcedure(aClass);
|
||||
<error descr="Incompatible types. Found: 'java.lang.Class<capture<? extends Command>>', required: 'java.lang.Class<Command>'">Class<Command> c = aClass;</error>
|
||||
<error descr="Incompatible types. Found: 'java.lang.Class<capture<? extends Command>>', required: 'java.lang.Class<C>'">Class<C> c1 = aClass;</error>
|
||||
}
|
||||
|
||||
}
|
||||
@@ -301,6 +301,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA67682() { doTest5(false); }
|
||||
public void testIDEA57391() { doTest5(false); }
|
||||
public void testIDEA110869() { doTest5(false); }
|
||||
public void testIDEA110947() { doTest5(false); }
|
||||
|
||||
public void testJavaUtilCollections_NoVerify() throws Exception {
|
||||
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
|
||||
|
||||
Reference in New Issue
Block a user