package org.apidesign.demo.rubyjs.fromjava;

import com.oracle.truffle.api.source.Source;
import com.oracle.truffle.api.vm.PolyglotEngine;
import java.io.File;
import java.net.URL;

public final class Main {
    private Main() {
    }

    public static void main(String[] args) throws Exception {
        System.err.println("Setting up PolyglotEngine");
        PolyglotEngine vm = PolyglotEngine.newBuilder().
            build();

        URL url = Main.class.getProtectionDomain().getCodeSource().getLocation();
        File local = new File(url.toURI());
        for (;;) {
            File sieveInRuby = new File(local, "sieve.rb");
            if (sieveInRuby.exists()) {
                break;
            }
            local = local.getParentFile();
        }

        Source ruby = Source.fromFileName(new File(local, "sieve.rb").getPath());
        Source js = Source.fromFileName(new File(local, "sieve.js").getPath());

        vm.eval(ruby);
        vm.eval(js);
    }
}

@@ -788,36 +788,34 @@
 by = Source.
-fromFileName
+newBuilder
 (new File(lo
@@ -830,26 +830,24 @@
 eve.rb%22)
-.getPath()
+).build(
 );%0A     
@@ -872,20 +872,18 @@
 rce.
-fromFileName
+newBuilder
 (new
@@ -910,18 +910,16 @@
 js%22)
-.getPath()
+).build(
 );%0A%0A

Use builder to construct the source