create field from parameter: array types (IDEA-58140)

This commit is contained in:
anna
2010-08-31 15:04:06 +04:00
parent 6e706cfc31
commit 3942c3f88d
3 changed files with 18 additions and 0 deletions
@@ -56,6 +56,7 @@ public class CreateFieldFromParameterAction implements IntentionAction {
if (parameter == null) return null;
PsiType type = parameter.getType();
if (type instanceof PsiEllipsisType) type = ((PsiEllipsisType)type).toArrayType();
if (type instanceof PsiArrayType) return new PsiType[]{type};
final PsiClassType.ClassResolveResult result = PsiUtil.resolveGenericsClassInType(type);
final PsiClass psiClass = result.getElement();
if (psiClass == null) return new PsiType[] {type};
@@ -0,0 +1,10 @@
// "Create Field For Parameter 'p1'" "true"
class Test{
private final String[] myP1;
void f(String[] p1){
myP1 = p1;
}
}
@@ -0,0 +1,7 @@
// "Create Field For Parameter 'p1'" "true"
class Test{
void f(String[] p<caret>1){
}
}