make normalize return denotable type (IDEA-140528)

This commit is contained in:
Anna Kozlova
2015-05-21 21:53:44 +02:00
parent f18948a3a2
commit 34d5b5f027
3 changed files with 15 additions and 1 deletions
@@ -423,7 +423,8 @@ public class PsiImplUtil {
return wildcardType.isSuper() ? wildcardType.getBound() : PsiCapturedWildcardType.create(wildcardType, expression);
}
else {
return ((PsiCapturedWildcardType)type).getUpperBound();
final PsiType upperBound = ((PsiCapturedWildcardType)type).getUpperBound();
return upperBound instanceof PsiWildcardType ? doNormalizeWildcardByPosition(upperBound, expression, toplevel) : upperBound;
}
}
@@ -0,0 +1,9 @@
class Test {
public final <T> T createStableValue(Class<?> aClass) {
return (T) createProxy(aClass.getSuperclass());
}
public static <T> T createProxy(final Class<T> superClass) {
return null;
}
}
@@ -504,6 +504,10 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
}
public void testRetrieveBoundFromCapturedWildcardUpperBoundOnNormalize() throws Exception {
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);