mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
substitute with bounds promotion: don't open captured wildcard for supers (IDEA-155370)
This commit is contained in:
@@ -117,22 +117,14 @@ public class PsiSubstitutorImpl implements PsiSubstitutor {
|
||||
if (glb instanceof PsiWildcardType) {
|
||||
return glb;
|
||||
}
|
||||
if (glb != null ) {
|
||||
return glb instanceof PsiCapturedWildcardType ? ((PsiCapturedWildcardType)glb).getWildcard()
|
||||
: PsiWildcardType.createExtends(typeParameter.getManager(), glb);
|
||||
if (glb instanceof PsiCapturedWildcardType) {
|
||||
PsiWildcardType wildcard = ((PsiCapturedWildcardType)glb).getWildcard();
|
||||
if (!wildcard.isSuper()) return wildcard;
|
||||
}
|
||||
|
||||
/*
|
||||
if (glb instanceof PsiCapturedWildcardType) {
|
||||
PsiWildcardType wildcard = ((PsiCapturedWildcardType)glb).getWildcard();
|
||||
if (!wildcard.isSuper()) return wildcard;
|
||||
}
|
||||
|
||||
if (glb != null ) {
|
||||
return PsiWildcardType.createExtends(typeParameter.getManager(), glb);
|
||||
}
|
||||
*/
|
||||
|
||||
if (glb != null) {
|
||||
return PsiWildcardType.createExtends(typeParameter.getManager(), glb);
|
||||
}
|
||||
}
|
||||
return substituted;
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import a.Provider;
|
||||
|
||||
public abstract class Test<T> {
|
||||
private void configure(Provider<T> provider,
|
||||
Test<? super T> sBind,
|
||||
Test<? extends T> eBind) {
|
||||
sBind.toProvider(provider);
|
||||
eBind.toProvider<error descr="Cannot resolve method 'toProvider(a.Provider<T>)'">(provider)</error><EOLError descr="';' expected"></EOLError>
|
||||
}
|
||||
|
||||
abstract void toProvider(Provider<? extends T> var1);
|
||||
abstract void toProvider(b.Provider<? extends T> var1);
|
||||
}
|
||||
+8
@@ -47,6 +47,14 @@ public class LightAdvHighlightingFixtureTest extends LightCodeInsightFixtureTest
|
||||
assertNull(ReferencesSearch.search(aClass).findFirst());
|
||||
}
|
||||
|
||||
public void testBoundsPromotionWithCapturedWildcards() throws Exception {
|
||||
myFixture.addClass("package a; public interface Provider<A> {}");
|
||||
myFixture.addClass("package b; public interface Provider<B> {}");
|
||||
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/daemonCodeAnalyzer/advFixture";
|
||||
|
||||
Reference in New Issue
Block a user