mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
wildcard substitution partly reverted (IDEA-122700)
This commit is contained in:
@@ -394,7 +394,7 @@ public class PsiSubstitutorImpl implements PsiSubstitutor {
|
||||
if (erasure != null) {
|
||||
final PsiType[] boundTypes = typeParameter.getExtendsListTypes();
|
||||
for (PsiType boundType : boundTypes) {
|
||||
if (TypeConversionUtil.isAssignable(boundType, erasure) || TypeConversionUtil.isAssignable(erasure, boundType)) {
|
||||
if (TypeConversionUtil.isAssignable(erasure, boundType)) {
|
||||
return boundType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ class WithingBounds {
|
||||
A<A<<error descr="Type parameter 'A' is not within its bound; should extend 'A<A>'">A</error>>> a3;
|
||||
|
||||
A<? extends A> a4;
|
||||
A<<error descr="Type parameter '? super A' is not within its bound; should extend 'A<A<T>>'">? super A</error>> a5;
|
||||
A<<error descr="Type parameter '? super A' is not within its bound; should extend 'A<? super A>'">? super A</error>> a5;
|
||||
A<<error descr="Type parameter 'A[]' is not within its bound; should extend 'A<A[]>'">A[]</error>> a7;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class Bug2<T extends Integer>{
|
||||
}
|
||||
|
||||
void bug1(Parametrized<? super T> param) {
|
||||
foo(param);
|
||||
<error descr="Inferred type 'capture<? super T>' for type parameter 'I' is not within its bound; should extend 'java.lang.Number'">foo(param)</error>;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class Test {
|
||||
}
|
||||
|
||||
void bug1(Parametrized<? super T> param) {
|
||||
<error descr="Inferred type 'java.io.Serializable' for type parameter 'I' is not within its bound; should extend 'java.lang.Number'">foo(param)</error>;
|
||||
<error descr="Inferred type 'capture<? super T>' for type parameter 'I' is not within its bound; should extend 'java.lang.Number'">foo(param)</error>;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
class Test {
|
||||
class Event {}
|
||||
class KeyEvent extends Event {
|
||||
int getCode() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
interface EventListener<T extends Event> {
|
||||
void handle(T event);
|
||||
}
|
||||
|
||||
class EventType<T extends Event>{}
|
||||
static final EventType<KeyEvent> KEY_PRESSED = null;
|
||||
|
||||
{
|
||||
addEventHandler(KEY_PRESSED, keyEvent -> {
|
||||
int i = keyEvent.getCode();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public final <T extends Event> void addEventHandler(final EventType<T> eventType, final EventListener<? super T> listener) {}
|
||||
|
||||
}
|
||||
@@ -340,8 +340,6 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA120153() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
public void testIDEA120563() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
|
||||
public void testSuperWildcardWithBoundPromotion() { 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()));
|
||||
assertNotNull(collectionsClass);
|
||||
|
||||
@@ -751,6 +751,8 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSuperWildcardWithBoundPromotion() { doTest();}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
@@ -174,6 +174,10 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIDEA122700() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user