[m-rev.] for review: add example of calling Mercury libraries from Java
Peter Wang
novalazy at gmail.com
Fri Dec 5 19:21:03 AEDT 2014
On Fri, 5 Dec 2014 13:44:13 +1100 (AEDT), Julien Fischer <jfischer at opturion.com> wrote:
> diff --git a/samples/java_interface/standalone_java/JavaMain.java b/samples/java_interface/standalone_java/JavaMain.java
> new file mode 100644
> index 0000000..814f917
> --- /dev/null
> +++ b/samples/java_interface/standalone_java/JavaMain.java
> @@ -0,0 +1,53 @@
...
> +
> + // When we have finished calling Mercury procedures then we need to
> + // invoke any finalisers specified using ':- finalise' declarations in
> + // the set of Mercury libraries we are using.
> + // The static method run_finalisers() in the JavaInternal class does
> + // this. It will also perform any Mercury runtime finalisation that
> + // may be needed.
> + //
> + JavaInternal.run_finalisers();
> +
> + // The Mercury exit status (as set by io.set_exit_status/1) may be read
> + // from the static field 'exit_status' in the JavaInternal class.
> + //
> + out.println("JavaMain: Mercury exit status = "
> + + JavaInternal.exit_status);
No, I disagree with documenting something called JavaInternal.
I suggest creating a new class with two methods to begin with:
public static void run_finalisers()
public static int get_exit_status()
Peter
More information about the reviews
mailing list