mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
new inference: non-wildcard parameterization
This commit is contained in:
@@ -123,11 +123,11 @@ public class FunctionalInterfaceParameterizationUtil {
|
||||
return parameterization;
|
||||
}
|
||||
|
||||
if (!parameterization.isAssignableFrom(psiClassType)) {
|
||||
if (!psiClassType.isAssignableFrom(parameterization)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return getNonWildcardParameterization(parameterization);
|
||||
return getNonWildcardParameterization((PsiClassType)psiClassType);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -173,7 +173,9 @@ public class FunctionalInterfaceParameterizationUtil {
|
||||
final PsiClassType Bi = extendsListTypes.length > 0 ? extendsListTypes[0]
|
||||
: PsiType.getJavaLangObject(psiClass.getManager(),
|
||||
GlobalSearchScope.allScope(psiClass.getProject()));
|
||||
if (PsiPolyExpressionUtil.mentionsTypeParameters(Bi, typeParametersSet)) return null;
|
||||
if (PsiPolyExpressionUtil.mentionsTypeParameters(Bi, typeParametersSet)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final PsiType bound = ((PsiWildcardType)paramType).getBound();
|
||||
if (bound == null) {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import java.util.function.Function;
|
||||
|
||||
class Sample {
|
||||
{
|
||||
Function<? extends String, ? extends Integer> f = (String s) -> s.length();
|
||||
}
|
||||
}
|
||||
@@ -134,6 +134,10 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testWildcardParameterization() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user