mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
replace <? extends Object> with <?> during substitution (IDEA-64775)
This commit is contained in:
@@ -25,6 +25,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -45,7 +46,7 @@ public class ClassLiteralGetter {
|
||||
PsiElement position = parameters.getPosition();
|
||||
if (classParameter instanceof PsiWildcardType) {
|
||||
final PsiWildcardType wildcardType = (PsiWildcardType)classParameter;
|
||||
classParameter = wildcardType.getBound();
|
||||
classParameter = wildcardType.isSuper() ? wildcardType.getSuperBound() : wildcardType.getExtendsBound();
|
||||
addInheritors = wildcardType.isExtends() && classParameter instanceof PsiClassType;
|
||||
} else if (!matcher.getPrefix().isEmpty()) {
|
||||
addInheritors = true;
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -66,6 +67,11 @@ public class PsiWildcardType extends PsiType {
|
||||
|
||||
public static PsiWildcardType changeBound(@NotNull PsiWildcardType type, @NotNull PsiType newBound) {
|
||||
LOG.assertTrue(type.getBound() != null);
|
||||
if (type.myIsExtending) {
|
||||
if (newBound.equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) {
|
||||
return createUnbounded(type.myManager);
|
||||
}
|
||||
}
|
||||
return new PsiWildcardType(type.myManager, type.myIsExtending, newBound);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
class D<T> {
|
||||
void foo(D<?> x){
|
||||
bar<error descr="'bar(D<? extends java.lang.Object>, D<? super java.lang.Object>)' in 'D' cannot be applied to '(D<capture<?>>, D<capture<?>>)'">(x,x)</error>;
|
||||
bar<error descr="'bar(D<?>, D<? super java.lang.Object>)' in 'D' cannot be applied to '(D<capture<?>>, D<capture<?>>)'">(x,x)</error>;
|
||||
}
|
||||
<T> void bar(D<? extends T> x, D<? super T> y){}
|
||||
}
|
||||
Reference in New Issue
Block a user