mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-230807 Change Signature refactoring inserts annotations for return type fully-qualified
GitOrigin-RevId: 97c3ae10bdcca6c2f9517e187691880516b71cbc
This commit is contained in:
committed by
intellij-monorepo-bot
parent
052e2eb5dd
commit
90e778536b
+6
-1
@@ -803,7 +803,12 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
|
||||
if (method.getName().equals(changeInfo.getNewName())) {
|
||||
final PsiTypeElement typeElement = method.getReturnTypeElement();
|
||||
if (typeElement != null) {
|
||||
javaCodeStyleManager.shortenClassReferences(typeElement.replace(factory.createTypeElement(returnType)));
|
||||
PsiTypeElement replacementType = factory.createTypeElement(returnType);
|
||||
javaCodeStyleManager.shortenClassReferences(typeElement.replace(replacementType));
|
||||
if (replacementType.getText().startsWith("@")) {
|
||||
// Annotation could be moved to modifier list during the replace
|
||||
javaCodeStyleManager.shortenClassReferences(method.getModifierList());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
class X {
|
||||
String <caret>test() { return null; }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class X {
|
||||
@NotNull String test() { return null; }
|
||||
}
|
||||
@@ -576,5 +576,9 @@ public class ChangeSignatureTest extends ChangeSignatureBaseTest {
|
||||
|
||||
}
|
||||
|
||||
public void testAddReturnAnnotation() {
|
||||
doTest(null, null, "@org.jetbrains.annotations.NotNull java.lang.String", method -> new ParameterInfoImpl[0], false);
|
||||
}
|
||||
|
||||
/* workers */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user