void (final @NotNull Project project, @NotNull ProblemDescriptor descriptor) { final PsiElement element = descriptor.getPsiElement().getParent(); if (!(element instanceof PsiMethod method)) { return; } WriteAction.run(() -> { final VirtualFile vFile = method.getContainingFile().getVirtualFile(); if (ReadonlyStatusHandler.getInstance(method.getProject()).ensureFilesWritable(List.of(vFile)).hasReadonlyFiles()) { return; } method.getModifierList().setModifierProperty(PsiModifier.STATIC, true); }); final PsiType type = (PsiType)infos[1]; ParameterInfoImpl @NotNull [] parameterInfo = new ParameterInfoImpl[0]; var csp = JavaRefactoringFactory.getInstance(project) .createChangeSignatureProcessor(method, false, PsiModifier.PUBLIC, method.getName(), type, parameterInfo, null, null, null, null); csp.run(); }