wildcard bounds composition (IDEA-113297)

This commit is contained in:
Anna Kozlova
2014-01-30 20:13:49 +04:00
parent f0bfe3604e
commit 876784bc24
3 changed files with 29 additions and 1 deletions
@@ -176,12 +176,18 @@ public class PsiSubstitutorImpl implements PsiSubstitutor {
}
private static PsiType handleBoundComposition(PsiWildcardType wildcardType, PsiWildcardType bound) {
final PsiType newBoundBound = bound.getBound();
if (bound.isExtends() == wildcardType.isExtends()) {
final PsiType newBoundBound = bound.getBound();
if (newBoundBound != null) {
return rebound(wildcardType, newBoundBound);
}
}
if (newBoundBound != null) {
return wildcardType.isExtends() ? PsiWildcardType.createExtends(wildcardType.getManager(), newBoundBound)
: PsiWildcardType.createSuper(wildcardType.getManager(), newBoundBound);
}
return PsiWildcardType.createUnbounded(wildcardType.getManager());
}
@@ -0,0 +1,18 @@
public class Test {
{
addListener(this::editPropertyChanged);
}
void addListener(ChangeListener<? super Boolean> changeListener){}
public void editPropertyChanged(Value<? extends Boolean> property) {}
interface ChangeListener <T> {
void changed(Value<? extends T> value);
}
class Value<K> {}
}
@@ -145,6 +145,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testIDEA113297() throws Exception {
doTest();
}
private void doTest() {
doTest(false);
}