[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
This commit is contained in:
Tagir Valeev
2024-10-11 08:10:27 +00:00
committed by intellij-monorepo-bot
parent dad5341dd9
commit f382d9421e
@@ -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)
}