JavaMethodDescriptor: prefer exact type element text when there are no top-level annotations (IDEA-232690)

GitOrigin-RevId: 5d5bf157f18f979b802bbe98c19bd5f6e057b93c
This commit is contained in:
Tagir Valeev
2020-02-19 05:11:11 +00:00
committed by intellij-monorepo-bot
parent d40e543cea
commit 4c20010c0e
@@ -1,10 +1,7 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.changeSignature;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiParameter;
import com.intellij.psi.PsiTypeElement;
import com.intellij.psi.*;
import com.intellij.psi.util.AccessModifier;
import com.intellij.psi.util.JavaPsiRecordUtil;
import com.intellij.psi.util.PsiUtil;
@@ -58,7 +55,14 @@ public class JavaMethodDescriptor implements MethodDescriptor<ParameterInfoImpl,
@Nullable
public String getReturnTypeText() {
final PsiTypeElement typeElement = myMethod.getReturnTypeElement();
return typeElement != null ? typeElement.getType().getPresentableText(true) : null;
if (typeElement != null) {
PsiType type = typeElement.getType();
if (type.getAnnotations().length > 0) {
return type.getPresentableText(true);
}
return typeElement.getText();
}
return null;
}
@Override