LocalQuickFix (final Object... infos) { if (infos.length == 0) return null; if (infos[0] instanceof PsiClass aClass) { final String signature = "@" + PARAMETERS_FQN + " public static java.lang.Iterable<java.lang.Object[]> parameters()"; CreateMethodQuickFix fix = CreateMethodQuickFix.createFix(aClass, signature, ""); if (fix == null) return null; return new LocalQuickFix() { @Override public @NotNull String getName() { return getFamilyName(); } @Override public @NotNull String getFamilyName() { return InspectionGadgetsBundle.message("fix.data.provider.create.method.fix.name"); } @Override public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { fix.applyFix(project, descriptor); } }; } return new InspectionGadgetsFix() { @Override public boolean startInWriteAction() { return false; } @Override protected void doFix(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(); } @Override @NotNull public String getName() { return InspectionGadgetsBundle.message("fix.data.provider.signature.fix.name", infos[0]); } @NotNull @Override public String getFamilyName() { return InspectionGadgetsBundle.message("fix.data.provider.signature.family.name"); } }; }