mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not open capture for upper level wildcards with equals constraint (IDEA-57439)
This commit is contained in:
+1
-1
@@ -863,7 +863,7 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
|
||||
PsiType patternType,
|
||||
final ConstraintType constraintType,
|
||||
final int depth) {
|
||||
if (arg instanceof PsiCapturedWildcardType) arg = ((PsiCapturedWildcardType)arg).getWildcard(); //reopen
|
||||
if (arg instanceof PsiCapturedWildcardType && (depth < 2 || constraintType != ConstraintType.EQUALS)) arg = ((PsiCapturedWildcardType)arg).getWildcard(); //reopen
|
||||
|
||||
if (patternType.equals(param)) {
|
||||
return processArgType(arg, constraintType, depth < 2);
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ class A<T> {
|
||||
}
|
||||
|
||||
void bar(A<?> x){
|
||||
baz<error descr="'baz(A<A<?>>)' in 'A' cannot be applied to '(A<A<capture<?>>>)'">(x.foo())</error>;
|
||||
baz<error descr="'baz(A<A<? extends S>>)' in 'A' cannot be applied to '(A<A<capture<?>>>)'">(x.foo())</error>;
|
||||
}
|
||||
|
||||
<S> void baz(A<A<? extends S>> x){}
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
class A<T> {}
|
||||
|
||||
class B<T> extends A<A<T>> {
|
||||
void bar(B<?> b, B<? extends String> eb, B<? super String> sb, B<String> s) {
|
||||
foo(b);
|
||||
foo(eb);
|
||||
foo(sb);
|
||||
foo(s);
|
||||
|
||||
<error descr="Inferred type 'capture<?>' for type parameter 'T' is not within its bound; should extend 'java.lang.String'">foo1(b)</error>;
|
||||
foo1(eb);
|
||||
<error descr="Inferred type 'capture<? super java.lang.String>' for type parameter 'T' is not within its bound; should extend 'java.lang.String'">foo1(sb)</error>;
|
||||
foo1(s);
|
||||
|
||||
foo2(b);
|
||||
foo2(eb);
|
||||
foo2(sb);
|
||||
foo2(s);
|
||||
|
||||
foo3<error descr="'foo3(A<A<? extends T>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
|
||||
foo3<error descr="'foo3(A<A<? extends T>>)' in 'B' cannot be applied to '(B<capture<? extends java.lang.String>>)'">(eb)</error>;
|
||||
foo3<error descr="'foo3(A<A<? extends T>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
|
||||
foo3<error descr="'foo3(A<A<? extends java.lang.String>>)' in 'B' cannot be applied to '(B<java.lang.String>)'">(s)</error>;
|
||||
|
||||
foo4<error descr="'foo4(A<A<? super T>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
|
||||
foo4<error descr="'foo4(A<A<? super T>>)' in 'B' cannot be applied to '(B<capture<? extends java.lang.String>>)'">(eb)</error>;
|
||||
foo4<error descr="'foo4(A<A<? super T>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
|
||||
foo4<error descr="'foo4(A<A<? super java.lang.String>>)' in 'B' cannot be applied to '(B<java.lang.String>)'">(s)</error>;
|
||||
|
||||
foo5(b);
|
||||
foo5(eb);
|
||||
foo5(sb);
|
||||
foo5(s);
|
||||
}
|
||||
|
||||
|
||||
<T> void foo(A<A<T>> x) {}
|
||||
<T extends String> void foo1(A<A<T>> x) {}
|
||||
<T> void foo2(A<? extends A<T>> x) {}
|
||||
<T> void foo3(A<A<? extends T>> x) {}
|
||||
<T> void foo4(A<A<? super T>> x) {}
|
||||
<T> void foo5(A<? super A<T>> x) {}
|
||||
}
|
||||
@@ -307,6 +307,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA109556() { doTest5(false); }
|
||||
public void testIDEA107440() { doTest5(false); }
|
||||
public void testIDEA57289() { doTest5(false); }
|
||||
public void testIDEA57439() { 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