// Path: src/stone/StoneException.java
// public class StoneException extends RuntimeException {
//     public StoneException(String m) { super(m); }
//     public StoneException(String m, ASTree t) {
//         super(m + " " + t.location());
//     }
// }
// 
// Path: src/chap7/Function.java
// public class Function {
//     protected ParameterList parameters;
//     protected BlockStmnt body;
//     protected Environment env;
//     public Function(ParameterList parameters, BlockStmnt body, Environment env) {
//         this.parameters = parameters;
//         this.body = body;
//         this.env = env;
//     }
//     public ParameterList parameters() { return parameters; }
//     public BlockStmnt body() { return body; }
//     public Environment makeEnv() { return new NestedEnv(env); }
//     @Override public String toString() { return "<fun:" + hashCode() + ">"; }
// }


import stone.StoneException;
import chap7.Function;
package chap14;

public class JavaFunction extends Function {
    protected String className;
    protected Class<?> clazz;
    public JavaFunction(String name, String method, JavaLoader loader) {
        super(null, null, null);
        className = className(name);
        clazz = loader.load(className, method);
    }
    public static String className(String name) {
        return "chap14.java." + name;
    }
    public Object invoke(Object[] args) {
        try {
            return clazz.getDeclaredMethods()[0].invoke(null, args);
        } catch (Exception e) {
// Path: src/stone/StoneException.java
// public class StoneException extends RuntimeException {
//     public StoneException(String m) { super(m); }
//     public StoneException(String m, ASTree t) {
//         super(m + " " + t.location());
//     }
// }
// 
// Path: src/chap7/Function.java
// public class Function {
//     protected ParameterList parameters;
//     protected BlockStmnt body;
//     protected Environment env;
//     public Function(ParameterList parameters, BlockStmnt body, Environment env) {
//         this.parameters = parameters;
//         this.body = body;
//         this.env = env;
//     }
//     public ParameterList parameters() { return parameters; }
//     public BlockStmnt body() { return body; }
//     public Environment makeEnv() { return new NestedEnv(env); }
//     @Override public String toString() { return "<fun:" + hashCode() + ">"; }
// }


// Path: src/chap14/JavaFunction.java
import stone.StoneException;
import chap7.Function;

package chap14;

public class JavaFunction extends Function {
    protected String className;
    protected Class<?> clazz;
    public JavaFunction(String name, String method, JavaLoader loader) {
        super(null, null, null);
        className = className(name);
        clazz = loader.load(className, method);
    }
    public static String className(String name) {
        return "chap14.java." + name;
    }
    public Object invoke(Object[] args) {
        try {
            return clazz.getDeclaredMethods()[0].invoke(null, args);
        } catch (Exception e) {
            throw new StoneException(e.getMessage());