PsiElement (Project project, PsiType componentType, PsiElement typePlace) { final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project); if (componentType instanceof PsiClassType) { return typePlace.replace(factory.createReferenceElementByType((PsiClassType)componentType)); } else { return typePlace.replace(getTypeKeyword(((PsiNewExpression)factory.createExpressionFromText("new " + componentType.getPresentableText() + "[0]", typePlace)))); } }