class FileUtil {

    private static final RuntimeEnvironment env = RuntimeEnvironment.getInstance();

    // private to enforce static
    private FileUtil() {
    }

    /**
     * @param path path relative to source root
     * @return file object corresponding to the file under source root
     * @throws FileNotFoundException if the file constructed from the {@code path} parameter and source root
     * does not exist
     * @throws InvalidPathException if the file constructed from the {@code path} parameter and source root
     * leads outside source root
     * @throws NoPathParameterException if the {@code path} parameter is null
     */
    @SuppressWarnings("lgtm[java/path-injection]")
    public static File toFile(String path) throws NoPathParameterException, IOException {<FILL_FUNCTION_BODY>}
}

        if (path == null) {
            throw new NoPathParameterException("Missing path parameter");
        }

        File file = new File(env.getSourceRootFile(), path);

        if (!file.getCanonicalPath().startsWith(env.getSourceRootPath() + File.separator)) {
            throw new InvalidPathException(path, "File points to outside of source root");
        }

        if (!file.exists()) {
            throw new FileNotFoundException("File " + file + " not found");
        }

        return file;
    
<no_super_class>