mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
ensure denotable types
This commit is contained in:
+2
-1
@@ -63,6 +63,7 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiTypesUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.psi.util.proximity.PsiProximityComparator;
|
||||
import com.intellij.refactoring.util.RefactoringUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -251,7 +252,7 @@ public class CreateFromUsageUtils {
|
||||
Pair<PsiExpression, PsiType> arg = arguments.get(i);
|
||||
PsiExpression exp = arg.first;
|
||||
|
||||
PsiType argType = exp == null ? arg.second : exp.getType();
|
||||
PsiType argType = exp == null ? arg.second : RefactoringUtil.getTypeByExpression(exp);
|
||||
SuggestedNameInfo suggestedInfo = JavaCodeStyleManager.getInstance(psiManager.getProject()).suggestVariableName(
|
||||
VariableKind.PARAMETER, null, exp, argType);
|
||||
@NonNls String[] names = suggestedInfo.names; //TODO: callback about used name
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Create method 'foo'" "true"
|
||||
class A {
|
||||
private List<? extends CharSequence> sequences = null;
|
||||
|
||||
{
|
||||
foo(sequences.map());
|
||||
}
|
||||
|
||||
private void foo(List<?> map) {
|
||||
|
||||
}
|
||||
|
||||
interface List<T> {
|
||||
List<? super T> map();
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Create method 'foo'" "true"
|
||||
class A {
|
||||
private List<? extends CharSequence> sequences = null;
|
||||
|
||||
{
|
||||
f<caret>oo(sequences.map());
|
||||
}
|
||||
|
||||
interface List<T> {
|
||||
List<? super T> map();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user