Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.
This repository was archived by the owner on Jun 14, 2024. It is now read-only.

Content.rec(..) in LogEntry is recursive function, but does not use tail rec optimisation #400

@dmytroDragan

Description

@dmytroDragan

Content.rec(..) in LogEntry is recursive function, but does not use tail rec optimisation

private def rec[T](
                      prefixPath: Path,
                      directory: Directory,
                      func: (FileInfo, Path) => T): Seq[T] = {
    val files = directory.files.map(f => func(f, prefixPath))
    files ++ directory.subDirs.flatMap { dir =>
      rec(new Path(prefixPath, dir.name), dir, func)
    }
  }

It is a potential issue which in some day could give StackOverflowError.
I could quickly fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    untriagedThis is the default tag for a newly created issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions