mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
inline: use wildcard bound to avoid ? in top level type element (IDEA-144883)
This commit is contained in:
@@ -343,6 +343,12 @@ public class InlineUtil {
|
||||
PsiElement resolved = resolveResult.getElement();
|
||||
if (resolved instanceof PsiTypeParameter) {
|
||||
PsiType newType = resolveResult.getSubstitutor().putAll(substitutor).substitute((PsiTypeParameter)resolved);
|
||||
if (newType instanceof PsiCapturedWildcardType) {
|
||||
newType = ((PsiCapturedWildcardType)newType).getUpperBound();
|
||||
}
|
||||
if (newType instanceof PsiWildcardType) {
|
||||
newType = ((PsiWildcardType)newType).getBound();
|
||||
}
|
||||
if (newType == null) {
|
||||
newType = PsiType.getJavaLangObject(resolved.getManager(), resolved.getResolveScope());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
interface Pair<A extends String> {
|
||||
A get();
|
||||
}
|
||||
|
||||
class B {
|
||||
<V extends String> void f(Pair<V> p) {
|
||||
V v = p.get();
|
||||
}
|
||||
|
||||
{
|
||||
Pair<?> p = null;
|
||||
<caret>f(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
interface Pair<A extends String> {
|
||||
A get();
|
||||
}
|
||||
|
||||
class B {
|
||||
|
||||
{
|
||||
Pair<?> p = null;
|
||||
String v = p.get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -185,6 +185,10 @@ public class InlineMethodTest extends LightRefactoringTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSubstitutionForWildcards() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testParamNameConflictsWithLocalVar() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user