mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
substitute with bounds promotion: don't wrap wildcards
This commit is contained in:
@@ -110,6 +110,9 @@ public class PsiSubstitutorImpl implements PsiSubstitutor {
|
||||
if (substituted instanceof PsiWildcardType && !((PsiWildcardType)substituted).isSuper()) {
|
||||
final PsiWildcardType wildcardType = (PsiWildcardType)substituted;
|
||||
final PsiType glb = PsiCapturedWildcardType.captureUpperBound(typeParameter, wildcardType, this);
|
||||
if (glb instanceof PsiWildcardType) {
|
||||
return glb;
|
||||
}
|
||||
if (glb != null ) {
|
||||
return glb instanceof PsiCapturedWildcardType ? ((PsiCapturedWildcardType)glb).getWildcard()
|
||||
: PsiWildcardType.createExtends(typeParameter.getManager(), glb);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
class C<M extends L, L> {}
|
||||
|
||||
class B<K extends C<?, ?>>{
|
||||
K get() {
|
||||
return null;
|
||||
}
|
||||
|
||||
{
|
||||
C c = get();
|
||||
}
|
||||
}
|
||||
@@ -593,4 +593,8 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testReturnTypeSubstitutableForSameOverrideEquivalentMethods() throws Exception {
|
||||
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
|
||||
}
|
||||
|
||||
public void testCaptureConversionWithWildcardBounds() throws Exception {
|
||||
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user