summaryrefslogtreecommitdiff
path: root/java/java-impl/src/com/intellij/refactoring/anonymousToInner/AnonymousToInnerDialog.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/java-impl/src/com/intellij/refactoring/anonymousToInner/AnonymousToInnerDialog.java')
-rw-r--r--java/java-impl/src/com/intellij/refactoring/anonymousToInner/AnonymousToInnerDialog.java29
1 files changed, 16 insertions, 13 deletions
diff --git a/java/java-impl/src/com/intellij/refactoring/anonymousToInner/AnonymousToInnerDialog.java b/java/java-impl/src/com/intellij/refactoring/anonymousToInner/AnonymousToInnerDialog.java
index 7bca3c07b4c0..80201559ef34 100644
--- a/java/java-impl/src/com/intellij/refactoring/anonymousToInner/AnonymousToInnerDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/anonymousToInner/AnonymousToInnerDialog.java
@@ -86,20 +86,23 @@ class AnonymousToInnerDialog extends DialogWrapper{
final String[] names;
String name = myAnonClass.getBaseClassReference().getReferenceName();
PsiType[] typeParameters = myAnonClass.getBaseClassReference().getTypeParameters();
- if (typeParameters.length > 0) {
- names = new String[]{StringUtil.join(typeParameters, new Function<PsiType, String>() {
- public String fun(PsiType psiType) {
- PsiType type = psiType;
- if (psiType instanceof PsiClassType) {
- type = TypeConversionUtil.erasure(psiType);
- }
- if (type == null || type.equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) return "";
- if (type instanceof PsiArrayType) {
- type = type.getDeepComponentType();
- }
- return StringUtil.getShortName(type.getPresentableText());
+
+ final String typeParamsList = StringUtil.join(typeParameters, new Function<PsiType, String>() {
+ public String fun(PsiType psiType) {
+ PsiType type = psiType;
+ if (psiType instanceof PsiClassType) {
+ type = TypeConversionUtil.erasure(psiType);
}
- }, "") + name, "My" + name};
+ if (type == null || type.equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) return "";
+ if (type instanceof PsiArrayType) {
+ type = type.getDeepComponentType();
+ }
+ return StringUtil.getShortName(type.getPresentableText());
+ }
+ }, "") + name;
+
+ if (!typeParamsList.equals(name)) {
+ names = new String[]{typeParamsList, "My" + name};
} else {
names = new String[]{"My" + name};
}