mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
leave capture during bound composition of unbounded wildcards (IDEA-125423)
This commit is contained in:
@@ -158,16 +158,10 @@ public class PsiSubstitutorImpl implements PsiSubstitutor {
|
||||
}
|
||||
if (newBound instanceof PsiCapturedWildcardType) {
|
||||
final PsiWildcardType wildcard = ((PsiCapturedWildcardType)newBound).getWildcard();
|
||||
if (wildcardType.isExtends() != wildcard.isExtends()) {
|
||||
if (wildcard.isBounded()) {
|
||||
return wildcardType.isExtends() ? PsiWildcardType.createExtends(wildcardType.getManager(), newBound)
|
||||
: PsiWildcardType.createSuper(wildcardType.getManager(), newBound);
|
||||
}
|
||||
else {
|
||||
return newBound;
|
||||
}
|
||||
if (wildcardType.isExtends() != wildcard.isExtends() && wildcard.isBounded()) {
|
||||
return wildcardType.isExtends() ? PsiWildcardType.createExtends(wildcardType.getManager(), newBound)
|
||||
: PsiWildcardType.createSuper(wildcardType.getManager(), newBound);
|
||||
}
|
||||
if (!wildcard.isBounded()) return PsiWildcardType.createUnbounded(wildcardType.getManager());
|
||||
return newBound;
|
||||
}
|
||||
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class FooBar<T> {
|
||||
void foo(final FooBar<?> fooBar){
|
||||
fooBar.supertype<error descr="'supertype(java.lang.Class<capture<?>>)' in 'FooBar' cannot be applied to '(java.lang.Class<java.lang.Iterable>)'">(Iterable.class)</error>;
|
||||
}
|
||||
|
||||
void foo1(final FooBar<? super T> fooBar){
|
||||
fooBar.supertype<error descr="'supertype(java.lang.Class<capture<? super T>>)' in 'FooBar' cannot be applied to '(java.lang.Class<java.lang.Iterable>)'">(Iterable.class)</error>;
|
||||
}
|
||||
|
||||
void foo2(final FooBar<? extends T> fooBar){
|
||||
fooBar.supertype<error descr="'supertype(java.lang.Class<? super capture<? extends T>>)' in 'FooBar' cannot be applied to '(java.lang.Class<java.lang.Iterable>)'">(Iterable.class)</error>;
|
||||
}
|
||||
|
||||
void supertype(Class<? super T> superclass) {}
|
||||
}
|
||||
@@ -355,6 +355,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA24479() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
public void testIDEA118536() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
public void testIDEA125744() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
public void testIDEA125423() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
|
||||
public void testJavaUtilCollections_NoVerify() throws Exception {
|
||||
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
|
||||
|
||||
Reference in New Issue
Block a user