From ccd71b0d992a6a1d9270a8ad462af19f0e25bb27 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Wed, 20 Jun 2007 19:37:43 -0600 Subject: [PATCH] add bare-bones set of Java classes for testing --- input/Test.java | 7 +++++ input/java/lang/Class.java | 7 +++++ input/java/lang/Object.java | 47 ++++++++++++++++++++++++++++++++++ input/java/lang/String.java | 8 ++++++ input/java/lang/Throwable.java | 6 +++++ input/vm/VM.java | 21 +++++++++++++++ 6 files changed, 96 insertions(+) create mode 100644 input/Test.java create mode 100644 input/java/lang/Class.java create mode 100644 input/java/lang/Object.java create mode 100644 input/java/lang/String.java create mode 100644 input/java/lang/Throwable.java create mode 100644 input/vm/VM.java diff --git a/input/Test.java b/input/Test.java new file mode 100644 index 0000000000..38f7f19306 --- /dev/null +++ b/input/Test.java @@ -0,0 +1,7 @@ +public class Test { + + public static void main(String[] args) { + int a = 2 + 2; + } + +} diff --git a/input/java/lang/Class.java b/input/java/lang/Class.java new file mode 100644 index 0000000000..089286e17a --- /dev/null +++ b/input/java/lang/Class.java @@ -0,0 +1,7 @@ +package java.lang; + +public final class Class { + private Object body; + + private Class() { } +} diff --git a/input/java/lang/Object.java b/input/java/lang/Object.java new file mode 100644 index 0000000000..cb9ab57c7f --- /dev/null +++ b/input/java/lang/Object.java @@ -0,0 +1,47 @@ +package java.lang; + +import vm.VM; + +public class Object { + protected Object clone() { + return VM.clone(this); + } + + public boolean equals(Object o) { + return this == o; + } + + protected void finalize() { } + + public final Class getClass() { + return VM.getClass(this); + } + + public int hashCode() { + return VM.hashCode(this); + } + + public final void notify() { + VM.notify(this); + } + + public final void notifyAll() { + VM.notifyAll(this); + } + + public String toString() { + return VM.toString(this); + } + + public final void wait() { + VM.wait(this); + } + + public final void wait(long timeout) { + VM.wait(this, timeout); + } + + public final void wait(long timeout, int nanos) { + VM.wait(this, timeout, nanos); + } +} diff --git a/input/java/lang/String.java b/input/java/lang/String.java new file mode 100644 index 0000000000..9690e1bace --- /dev/null +++ b/input/java/lang/String.java @@ -0,0 +1,8 @@ +package java.lang; + +public final class String { + private byte[] bytes; + private int offset; + private int length; + private int hash; +} diff --git a/input/java/lang/Throwable.java b/input/java/lang/Throwable.java new file mode 100644 index 0000000000..2623e96aeb --- /dev/null +++ b/input/java/lang/Throwable.java @@ -0,0 +1,6 @@ +package java.lang; + +public class Throwable { + private String message; + private Object trace; +} diff --git a/input/vm/VM.java b/input/vm/VM.java new file mode 100644 index 0000000000..ff733f2fef --- /dev/null +++ b/input/vm/VM.java @@ -0,0 +1,21 @@ +package vm; + +public class VM { + public static native Object clone(Object o); + + public static native Class getClass(Object o); + + public static native int hashCode(Object o); + + public static native void notify(Object o); + + public static native void notifyAll(Object o); + + public static native String toString(Object o); + + public static native void wait(Object o); + + public static native void wait(Object o, long timeout); + + public static native void wait(Object o, long timeout, int nanos); +}