From f382d9421ea02eaf0c26b75b328c7bbffe682f0a Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Thu, 10 Oct 2024 09:45:55 +0200 Subject: [PATCH] [java-refactoring] Remove external type annotations on extracting Fixes IDEA-360115 Create method from List.of results in long jetbrains NotNull annotation GitOrigin-RevId: 8469180f82ac9c74edc7494778499daf409666f9 --- .../refactoring/extractMethod/newImpl/SignatureBuilder.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/newImpl/SignatureBuilder.kt b/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/newImpl/SignatureBuilder.kt index db77f1a15ab9..bcfc5402ba94 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/newImpl/SignatureBuilder.kt +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/newImpl/SignatureBuilder.kt @@ -7,6 +7,7 @@ import com.intellij.pom.java.JavaFeature import com.intellij.psi.* import com.intellij.psi.codeStyle.JavaCodeStyleManager import com.intellij.psi.codeStyle.JavaCodeStyleSettings +import com.intellij.psi.util.PsiTypesUtil import com.intellij.psi.util.PsiUtil import com.intellij.refactoring.extractMethod.newImpl.structures.InputParameter import com.intellij.refactoring.util.RefactoringUtil @@ -30,7 +31,7 @@ class SignatureBuilder(private val project: Project) { val parameterList = createParameterList(inputParameters, scope) val method = if (returnType != null) { - factory.createMethod(methodName, returnType, targetClass) + factory.createMethod(methodName, PsiTypesUtil.removeExternalAnnotations(returnType), targetClass) } else { factory.createConstructor("methodName", targetClass) }