String (PsiNewExpression element) { final PsiType newExprType = element.getType(); if (newExprType == null) { return null; } PsiClass containingClass = null; final PsiJavaCodeReferenceElement classReference = element.getClassOrAnonymousClassReference(); if (classReference != null) { final JavaResolveResult resolve = classReference.advancedResolve(false); final PsiElement resolveElement = resolve.getElement(); if (resolveElement instanceof PsiClass) { containingClass = (PsiClass)resolveElement; } } String classOrPrimitiveName = null; if (containingClass != null) { classOrPrimitiveName = getClassReferenceName(containingClass); } else if (newExprType instanceof PsiArrayType){ final PsiType deepComponentType = newExprType.getDeepComponentType(); if (deepComponentType instanceof PsiPrimitiveType) { classOrPrimitiveName = deepComponentType.getCanonicalText(); } } if (classOrPrimitiveName == null) { return null; } return classOrPrimitiveName + StringUtil.repeat("[]", newExprType.getArrayDimensions()); }