Code review comment: Shall we add this as a class variable, may be a constant

Code under review:
public CodeAction resolve(ResolvableCodeAction codeAction, CodeActionResolveContext context) {
        Optional<PackageCompilation> packageCompilation =
                context.workspace().waitAndGetPackageCompilation(context.filePath());
        if (packageCompilation.isEmpty() || context.currentDocument().isEmpty() ||
                context.currentSemanticModel().isEmpty()) {
            return codeAction;
        }

        Optional<Path> filePath = PathUtil.getPathFromURI(codeAction.getData().getFileUri());
        if (filePath.isEmpty()) {
            return codeAction;
        }

        CodeActionManager codeActionManager = packageCompilation.get().getCodeActionManager();

        String providerName = codeAction.getData().getCodeActionName();
        
        Gson gson = new Gson();
        List<?> actionData = (List<?>) codeAction.getData().getActionData();
        List<CodeActionArgument> arguments = actionData.stream()
                .map(gson::toJsonTree)
                .map(CodeActionArgument::from)
                .collect(Collectors.toList());
        
        CodeActionExecutionContext codeActionContext = CodeActionExecutionContextImpl.from(
                codeAction.getData().getFileUri(),
                filePath.get(),
                PositionUtil.getLinePosition(codeAction.getData().getRange().getStart()),
                context.currentDocument().get(),
                context.currentSemanticModel().get(),
                arguments
        );
        List<DocumentEdit> docEdits = codeActionManager.executeCodeAction(providerName, codeActionContext);

        
        List<Either<TextDocumentEdit, ResourceOperation>> edits = new LinkedList<>();
        docEdits.forEach(docEdit -> {
            Optional<SyntaxTree> originalST = PathUtil.getPathFromURI(docEdit.getFileUri())
                    .flatMap(editedFilePath -> context.workspace().document(editedFilePath))
                    .flatMap(doc -> Optional.of(doc.syntaxTree()));
            if (originalST.isEmpty()) {
                return;
            }

            TextRange textRange = originalST.get().rootNode().textRangeWithMinutiae();
            TextDocument textDocument = originalST.get().textDocument();
            LinePosition startPos = textDocument.linePositionFrom(textRange.startOffset());
            LinePosition endPos = textDocument.linePositionFrom(textRange.endOffset());
            LineRange lineRange = LineRange.from(originalST.get().filePath(), startPos, endPos);
            Range range = PositionUtil.toRange(LineRange.from(docEdit.getFileUri(),
                    lineRange.startLine(), lineRange.endLine()));
            TextEdit edit = new TextEdit(range, docEdit.getModifiedSyntaxTree().toSourceCode());
            TextDocumentEdit documentEdit = new TextDocumentEdit(new VersionedTextDocumentIdentifier(
                    docEdit.getFileUri(), null), Collections.singletonList(edit));
            Either<TextDocumentEdit, ResourceOperation> either = Either.forLeft(documentEdit);
            edits.add(either);
        });

        codeAction.setEdit(new WorkspaceEdit(edits));
        return codeAction;
    }

Line commented on: Gson gson = new Gson();

Revised code:
public CodeAction resolve(ResolvableCodeAction codeAction, CodeActionResolveContext context) {
        Optional<PackageCompilation> packageCompilation =
                context.workspace().waitAndGetPackageCompilation(context.filePath());
        if (packageCompilation.isEmpty() || context.currentDocument().isEmpty() ||
                context.currentSemanticModel().isEmpty()) {
            return codeAction;
        }

        CodeActionData codeActionData = codeAction.getData();
        Optional<Path> filePath = PathUtil.getPathFromURI(codeActionData.getFileUri());
        if (filePath.isEmpty()) {
            return codeAction;
        }

        CodeActionManager codeActionManager = packageCompilation.get().getCodeActionManager();

        String providerName = codeActionData.getCodeActionName();
        
        List<?> actionData = (List<?>) codeActionData.getActionData();
        List<CodeActionArgument> arguments = actionData.stream()
                .map(gson::toJsonTree)
                .map(CodeActionArgument::from)
                .collect(Collectors.toList());
        
        CodeActionExecutionContext codeActionContext = CodeActionExecutionContextImpl.from(
                codeActionData.getFileUri(),
                filePath.get(),
                PositionUtil.getLinePosition(codeActionData.getRange().getStart()),
                context.currentDocument().get(),
                context.currentSemanticModel().get(),
                arguments
        );
        List<DocumentEdit> docEdits = codeActionManager.executeCodeAction(providerName, codeActionContext);

        
        List<Either<TextDocumentEdit, ResourceOperation>> edits = new LinkedList<>();
        docEdits.stream()
                .map(docEdit -> toTextDocumentEdit(docEdit, context))
                .filter(Optional::isPresent)
                .forEach(docEdit -> {
                    Either<TextDocumentEdit, ResourceOperation> either = Either.forLeft(docEdit.get());
                    edits.add(either);
                });

        codeAction.setEdit(new WorkspaceEdit(edits));
        return codeAction;
    }