Signed-off-by: Tomek Grabiec <[email protected]>
---
Makefile | 8 +-
regression/jvm/ArrayExceptionsTest.java | 185 +++++++++++
regression/jvm/ExceptionsTest.java | 332 --------------------
.../jvm/IntegerArithmeticExceptionsTest.java | 75 +++++
regression/jvm/IntegerArithmeticTest.java | 11 -
regression/jvm/LongArithmeticExceptionsTest.java | 64 ++++
regression/jvm/MethodInvocationExceptionsTest.java | 85 +++++
...bjectCreationAndManipulationExceptionsTest.java | 93 ++++++
regression/jvm/SynchronizationExceptionsTest.java | 53 +++
regression/run-suite.sh | 6 +
10 files changed, 568 insertions(+), 344 deletions(-)
create mode 100644 regression/jvm/ArrayExceptionsTest.java
create mode 100644 regression/jvm/IntegerArithmeticExceptionsTest.java
create mode 100644 regression/jvm/LongArithmeticExceptionsTest.java
create mode 100644 regression/jvm/MethodInvocationExceptionsTest.java
create mode 100644
regression/jvm/ObjectCreationAndManipulationExceptionsTest.java
create mode 100644 regression/jvm/SynchronizationExceptionsTest.java
diff --git a/Makefile b/Makefile
index a63a5a5..70ea284 100644
--- a/Makefile
+++ b/Makefile
@@ -227,7 +227,13 @@ REGRESSION_TEST_SUITE_CLASSES = \
regression/jvm/ExceptionsTest.class \
regression/jvm/FibonacciTest.class \
regression/jvm/ObjectStackTest.class \
- regression/jvm/PrintTest.class
+ regression/jvm/PrintTest.class \
+ regression/jvm/ArrayExceptionsTest.class \
+ regression/jvm/IntegerArithmeticExceptionsTest.class \
+ regression/jvm/LongArithmeticExceptionsTest.class \
+ regression/jvm/MethodInvocationExceptionsTest.class \
+ regression/jvm/ObjectCreationAndManipulationExceptionsTest.class \
+ regression/jvm/SynchronizationExceptionsTest.class
$(REGRESSION_TEST_SUITE_CLASSES): %.class: %.java
$(E) " JAVAC " $@
diff --git a/regression/jvm/ArrayExceptionsTest.java
b/regression/jvm/ArrayExceptionsTest.java
new file mode 100644
index 0000000..d1a726d
--- /dev/null
+++ b/regression/jvm/ArrayExceptionsTest.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2009 Tomasz Grabiec
+ *
+ * This file is released under the GPL version 2 with the following
+ * clarification and special exception:
+ *
+ * Linking this library statically or dynamically with other modules is
+ * making a combined work based on this library. Thus, the terms and
+ * conditions of the GNU General Public License cover the whole
+ * combination.
+ *
+ * As a special exception, the copyright holders of this library give you
+ * permission to link this library with independent modules to produce an
+ * executable, regardless of the license terms of these independent
+ * modules, and to copy and distribute the resulting executable under terms
+ * of your choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module. An
+ * independent module is a module which is not derived from or based on
+ * this library. If you modify this library, you may extend this exception
+ * to your version of the library, but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version.
+ *
+ * Please refer to the file LICENSE for details.
+ */
+package jvm;
+
+/**
+ * @author Tomasz Grabiec
+ */
+public class ArrayExceptionsTest extends TestCase {
+ public static void testArrayLoadThrowsNullPointerException() {
+ boolean caught = false;
+ Object[] array = null;
+
+ try {
+ takeObject(array[0]);
+ } catch (NullPointerException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void testArrayLoadThrowsArrayIndexOutOfBoundsException() {
+ boolean caught = false;
+ Object[] array = new String[3];
+
+ try {
+ takeObject(array[3]);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void testArrayLoad() {
+ testArrayLoadThrowsNullPointerException();
+ testArrayLoadThrowsArrayIndexOutOfBoundsException();
+ }
+
+ public static void testArrayStoreThrowsNullPointerException() {
+ boolean caught = false;
+ Object[] array = null;
+
+ try {
+ array[0] = null;
+ } catch (NullPointerException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void testArrayStoreThrowsArrayIndexOutOfBoundsException() {
+ boolean caught = false;
+ Object[] array = new String[3];
+
+ try {
+ array[3] = "test";
+ } catch (ArrayIndexOutOfBoundsException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void testArrayStoreThrowsArrayStoreException() {
+ boolean caught = false;
+ Object[] array = new String[3];
+
+ try {
+ array[2] = new Integer(0);
+ } catch (ArrayStoreException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void testArrayStore() {
+ testArrayStoreThrowsNullPointerException();
+ testArrayStoreThrowsArrayIndexOutOfBoundsException();
+ testArrayStoreThrowsArrayStoreException();
+ }
+
+ public static void testArraylengthThrowsNullPointerException() {
+ boolean caught = false;
+ Object[] array = null;
+
+ try {
+ takeInt(array.length);
+ } catch (NullPointerException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void testAnewarrayThrowsNegativeArraySizeException() {
+ boolean caught = false;
+ Object array[] = null;
+
+ try {
+ array = new Object[-1];
+ } catch (NegativeArraySizeException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+
+ takeObject(array);
+ }
+
+ public static void testNewarrayThrowsNegativeArraySizeException() {
+ boolean caught = false;
+ int array[] = null;
+
+ try {
+ array = new int[-1];
+ } catch (NegativeArraySizeException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+
+ takeObject(array);
+ }
+
+ public static void testMultianewarrayThrowsNegativeArraySizeException() {
+ boolean caught = false;
+ Object array[][] = null;
+
+ try {
+ array = new Object[1][-1];
+ } catch (NegativeArraySizeException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+
+ caught = false;
+ try {
+ array = new Object[-1][1];
+ } catch (NegativeArraySizeException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+
+ takeObject(array);
+ }
+
+ public static void main(String args[]) {
+ testArrayLoad();
+ /* FIXME: testArrayStore(); */
+ testArraylengthThrowsNullPointerException();
+ testAnewarrayThrowsNegativeArraySizeException();
+ testNewarrayThrowsNegativeArraySizeException();
+ testMultianewarrayThrowsNegativeArraySizeException();
+
+ exit();
+ }
+}
\ No newline at end of file
diff --git a/regression/jvm/ExceptionsTest.java
b/regression/jvm/ExceptionsTest.java
index 97d6d6a..7d84cde 100644
--- a/regression/jvm/ExceptionsTest.java
+++ b/regression/jvm/ExceptionsTest.java
@@ -29,15 +29,6 @@ package jvm;
* @author Tomasz Grabiec
*/
public class ExceptionsTest extends TestCase {
- public static int static_field;
- public int field;
-
- private void privateMethod() {
- }
-
- public void publicMethod() {
- }
-
public static void testTryBlockDoesNotThrowAnything() {
boolean caught;
try {
@@ -131,121 +122,6 @@ public class ExceptionsTest extends TestCase {
} catch (Exception e) {}
}
- public static void testInvokespecial() {
- boolean caught = false;
- ExceptionsTest test = null;
-
- try {
- test.privateMethod();
- } catch (NullPointerException e) {
- caught = true;
- }
-
- assertTrue(caught);
- }
-
- public static void testInvokevirtual() {
- boolean caught = false;
- ExceptionsTest test = null;
-
- try {
- test.publicMethod();
- } catch (NullPointerException e) {
- caught = true;
- }
-
- assertTrue(caught);
- }
-
- public static void testArrayLoadThrowsNullPointerException() {
- boolean caught = false;
- Object[] array = null;
-
- try {
- takeObject(array[0]);
- } catch (NullPointerException e) {
- caught = true;
- }
-
- assertTrue(caught);
- }
-
- public static void testArrayLoadThrowsArrayIndexOutOfBoundsException() {
- boolean caught = false;
- Object[] array = new String[3];
-
- try {
- takeObject(array[3]);
- } catch (ArrayIndexOutOfBoundsException e) {
- caught = true;
- }
-
- assertTrue(caught);
- }
-
- public static void testArrayLoad() {
- testArrayLoadThrowsNullPointerException();
- testArrayLoadThrowsArrayIndexOutOfBoundsException();
- }
-
- public static void testArrayStoreThrowsNullPointerException() {
- boolean caught = false;
- Object[] array = null;
-
- try {
- array[0] = null;
- } catch (NullPointerException e) {
- caught = true;
- }
-
- assertTrue(caught);
- }
-
- public static void testArrayStoreThrowsArrayIndexOutOfBoundsException() {
- boolean caught = false;
- Object[] array = new String[3];
-
- try {
- array[3] = "test";
- } catch (ArrayIndexOutOfBoundsException e) {
- caught = true;
- }
-
- assertTrue(caught);
- }
-
- public static void testArrayStoreThrowsArrayStoreException() {
- boolean caught = false;
- Object[] array = new String[3];
-
- try {
- array[2] = new Integer(0);
- } catch (ArrayStoreException e) {
- caught = true;
- }
-
- assertTrue(caught);
- }
-
- public static void testArrayStore() {
- testArrayStoreThrowsNullPointerException();
- testArrayStoreThrowsArrayIndexOutOfBoundsException();
- testArrayStoreThrowsArrayStoreException();
- }
-
- public static void testArraylength() {
- boolean caught = false;
- Object[] array = null;
-
- try {
- takeInt(array.length);
- } catch (NullPointerException e) {
- caught = true;
- }
-
- assertTrue(caught);
- }
-
public static void testAthrow() {
boolean caught = false;
Exception exception = null;
@@ -260,193 +136,6 @@ public class ExceptionsTest extends TestCase {
assertTrue(caught);
}
- public static void testGetfield() {
- boolean caught = false;
- ExceptionsTest test = null;
-
- try {
- takeInt(test.field);
- } catch (NullPointerException e) {
- caught = true;
- }
-
- assertTrue(caught);
- }
-
- public static void testPutfield() {
- boolean caught = false;
- ExceptionsTest test = null;
-
- try {
- test.field = 1;
- } catch (NullPointerException e) {
- caught = true;
- }
-
- assertTrue(caught);
- }
-
- public static void testMonitorenter() {
- boolean caught = false;
- Object mon = null;
-
- try {
- synchronized(mon) {
- takeInt(1);
- }
- } catch (NullPointerException e) {
- caught = true;
- }
-
- assertTrue(caught);
- }
-
- public static void testIdiv() {
- boolean caught = false;
- int denominator = 0;
-
- try {
- takeInt(1 / denominator);
- } catch (ArithmeticException e) {
- caught = true;
- }
-
- assertTrue(caught);
- }
-
- public static void testIrem() {
- boolean caught = false;
- int denominator = 0;
-
- try {
- takeInt(1 % denominator);
- } catch (ArithmeticException e) {
- caught = true;
- }
-
- assertTrue(caught);
- }
-
- public static void testLdiv() {
- boolean caught = false;
- long denominator = 0;
-
- try {
- takeLong(1L / denominator);
- } catch (ArithmeticException e) {
- caught = true;
- }
-
- assertTrue(caught);
- }
-
- public static void testLrem() {
- boolean caught = false;
- long denominator = 0;
-
- try {
- takeLong(1L % denominator);
- } catch (ArithmeticException e) {
- caught = true;
- }
-
- assertTrue(caught);
- }
-
- public static void testCheckcast() {
- boolean caught = false;
- Object o = null;
- String s = null;
-
- try {
- s = (String)o;
- } catch (ClassCastException e) {
- caught = true;
- }
-
- assertFalse(caught);
-
- o = new Object();
-
- try {
- s = (String)o;
- } catch (ClassCastException e) {
- caught = true;
- }
-
- assertTrue(caught);
-
- takeObject(s);
- }
-
- public static void testAnewarray() {
- boolean caught = false;
- Object array[] = null;
-
- try {
- array = new Object[-1];
- } catch (NegativeArraySizeException e) {
- caught = true;
- }
-
- assertTrue(caught);
-
- takeObject(array);
- }
-
- public static void testNewarray() {
- boolean caught = false;
- int array[] = null;
-
- try {
- array = new int[-1];
- } catch (NegativeArraySizeException e) {
- caught = true;
- }
-
- assertTrue(caught);
-
- takeObject(array);
- }
-
- public static void testMultianewarray() {
- boolean caught = false;
- Object array[][] = null;
-
- try {
- array = new Object[1][-1];
- } catch (NegativeArraySizeException e) {
- caught = true;
- }
-
- assertTrue(caught);
-
- caught = false;
- try {
- array = new Object[-1][1];
- } catch (NegativeArraySizeException e) {
- caught = true;
- }
-
- assertTrue(caught);
-
- takeObject(array);
- }
-
- public static native void nativeMethod();
-
- public static void testUnsatisfiedLinkError() {
- boolean caught = false;
-
- try {
- nativeMethod();
- } catch (UnsatisfiedLinkError e) {
- caught = true;
- }
-
- assertTrue(caught);
- }
-
public static void main(String args[]) {
testTryBlockDoesNotThrowAnything();
testThrowAndCatchInTheSameMethod();
@@ -454,28 +143,7 @@ public class ExceptionsTest extends TestCase {
testMultipleCatchBlocks();
testNestedTryCatch();
testEmptyCatchBlock();
-
- testInvokespecial();
- testInvokevirtual();
- testArrayLoad();
-/* FIXME
- testArrayStore();
-*/
- testArraylength();
testAthrow();
- testGetfield();
- testPutfield();
- testMonitorenter();
- /* TODO: testMonitorexit() */
- testIdiv();
- testIrem();
- testLdiv();
- testLrem();
- testCheckcast();
- testAnewarray();
- testNewarray();
- testMultianewarray();
- testUnsatisfiedLinkError();
exit();
}
diff --git a/regression/jvm/IntegerArithmeticExceptionsTest.java
b/regression/jvm/IntegerArithmeticExceptionsTest.java
new file mode 100644
index 0000000..4d4669c
--- /dev/null
+++ b/regression/jvm/IntegerArithmeticExceptionsTest.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2009 Tomasz Grabiec
+ *
+ * This file is released under the GPL version 2 with the following
+ * clarification and special exception:
+ *
+ * Linking this library statically or dynamically with other modules is
+ * making a combined work based on this library. Thus, the terms and
+ * conditions of the GNU General Public License cover the whole
+ * combination.
+ *
+ * As a special exception, the copyright holders of this library give you
+ * permission to link this library with independent modules to produce an
+ * executable, regardless of the license terms of these independent
+ * modules, and to copy and distribute the resulting executable under terms
+ * of your choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module. An
+ * independent module is a module which is not derived from or based on
+ * this library. If you modify this library, you may extend this exception
+ * to your version of the library, but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version.
+ *
+ * Please refer to the file LICENSE for details.
+ */
+package jvm;
+
+/**
+ * @author Tomasz Grabiec
+ */
+public class IntegerArithmeticExceptionsTest extends TestCase {
+ public static void testIntegerDivisionByZeroRegReg() {
+ int x = 3;
+
+ try {
+ x = 1 / 0;
+ } catch (ArithmeticException e) {}
+
+ assertEquals(3, x);
+ }
+
+ public static void testIdivThrowsAritmeticException() {
+ boolean caught = false;
+ int denominator = 0;
+
+ try {
+ takeInt(1 / denominator);
+ } catch (ArithmeticException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void testIremThrowsAritmeticException() {
+ boolean caught = false;
+ int denominator = 0;
+
+ try {
+ takeInt(1 % denominator);
+ } catch (ArithmeticException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void main(String[] args) {
+ testIntegerDivisionByZeroRegReg();
+ testIdivThrowsAritmeticException();
+ testIremThrowsAritmeticException();
+
+ exit();
+ }
+}
\ No newline at end of file
diff --git a/regression/jvm/IntegerArithmeticTest.java
b/regression/jvm/IntegerArithmeticTest.java
index 92bdc7d..4a8f785 100644
--- a/regression/jvm/IntegerArithmeticTest.java
+++ b/regression/jvm/IntegerArithmeticTest.java
@@ -110,16 +110,6 @@ public class IntegerArithmeticTest extends TestCase {
assertEquals( 3, div( 6, 2));
}
- public static void testIntegerDivisionRegReg() {
- int x = 3;
-
- try {
- x = 1 / 0;
- } catch (ArithmeticException e) {}
-
- assertEquals(3, x);
- }
-
public static int div(int dividend, int divisor) {
return dividend / divisor;
}
@@ -273,7 +263,6 @@ public class IntegerArithmeticTest extends TestCase {
testIntegerMultiplication();
testIntegerMultiplicationOverflow();
testIntegerDivision();
- testIntegerDivisionRegReg();
testIntegerRemainder();
testIntegerNegation();
testIntegerNegationOverflow();
diff --git a/regression/jvm/LongArithmeticExceptionsTest.java
b/regression/jvm/LongArithmeticExceptionsTest.java
new file mode 100644
index 0000000..afe1838
--- /dev/null
+++ b/regression/jvm/LongArithmeticExceptionsTest.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2009 Tomasz Grabiec
+ *
+ * This file is released under the GPL version 2 with the following
+ * clarification and special exception:
+ *
+ * Linking this library statically or dynamically with other modules is
+ * making a combined work based on this library. Thus, the terms and
+ * conditions of the GNU General Public License cover the whole
+ * combination.
+ *
+ * As a special exception, the copyright holders of this library give you
+ * permission to link this library with independent modules to produce an
+ * executable, regardless of the license terms of these independent
+ * modules, and to copy and distribute the resulting executable under terms
+ * of your choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module. An
+ * independent module is a module which is not derived from or based on
+ * this library. If you modify this library, you may extend this exception
+ * to your version of the library, but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version.
+ *
+ * Please refer to the file LICENSE for details.
+ */
+package jvm;
+
+/**
+ * @author Tomasz Grabiec
+ */
+public class LongArithmeticExceptionsTest extends TestCase {
+ public static void testLdivThrowsAritmeticException() {
+ boolean caught = false;
+ long denominator = 0;
+
+ try {
+ takeLong(1L / denominator);
+ } catch (ArithmeticException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void testLremThrowsAritmeticException() {
+ boolean caught = false;
+ long denominator = 0;
+
+ try {
+ takeLong(1L % denominator);
+ } catch (ArithmeticException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void main(String[] args) {
+ testLdivThrowsAritmeticException();
+ testLremThrowsAritmeticException();
+
+ exit();
+ }
+}
\ No newline at end of file
diff --git a/regression/jvm/MethodInvocationExceptionsTest.java
b/regression/jvm/MethodInvocationExceptionsTest.java
new file mode 100644
index 0000000..06f1f3e
--- /dev/null
+++ b/regression/jvm/MethodInvocationExceptionsTest.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2009 Tomasz Grabiec
+ *
+ * This file is released under the GPL version 2 with the following
+ * clarification and special exception:
+ *
+ * Linking this library statically or dynamically with other modules is
+ * making a combined work based on this library. Thus, the terms and
+ * conditions of the GNU General Public License cover the whole
+ * combination.
+ *
+ * As a special exception, the copyright holders of this library give you
+ * permission to link this library with independent modules to produce an
+ * executable, regardless of the license terms of these independent
+ * modules, and to copy and distribute the resulting executable under terms
+ * of your choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module. An
+ * independent module is a module which is not derived from or based on
+ * this library. If you modify this library, you may extend this exception
+ * to your version of the library, but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version.
+ *
+ * Please refer to the file LICENSE for details.
+ */
+package jvm;
+
+/**
+ * @author Tomasz Grabiec
+ */
+public class MethodInvocationExceptionsTest extends TestCase {
+ private void privateMethod() {
+ }
+
+ public void publicMethod() {
+ }
+
+ public static void testInvokespecialThrowsNullPointerException() {
+ boolean caught = false;
+ MethodInvocationExceptionsTest test = null;
+
+ try {
+ test.privateMethod();
+ } catch (NullPointerException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void testInvokevirtualThrowsNullPointerException() {
+ boolean caught = false;
+ MethodInvocationExceptionsTest test = null;
+
+ try {
+ test.publicMethod();
+ } catch (NullPointerException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static native void nativeMethod();
+
+ public static void testInvokespecialThrowsUnsatisfiedLinkError() {
+ boolean caught = false;
+
+ try {
+ nativeMethod();
+ } catch (UnsatisfiedLinkError e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void main(String args[]) {
+ testInvokespecialThrowsNullPointerException();
+ testInvokevirtualThrowsNullPointerException();
+ testInvokespecialThrowsUnsatisfiedLinkError();
+
+ exit();
+ }
+}
\ No newline at end of file
diff --git a/regression/jvm/ObjectCreationAndManipulationExceptionsTest.java
b/regression/jvm/ObjectCreationAndManipulationExceptionsTest.java
new file mode 100644
index 0000000..26066b8
--- /dev/null
+++ b/regression/jvm/ObjectCreationAndManipulationExceptionsTest.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2009 Tomasz Grabiec
+ *
+ * This file is released under the GPL version 2 with the following
+ * clarification and special exception:
+ *
+ * Linking this library statically or dynamically with other modules is
+ * making a combined work based on this library. Thus, the terms and
+ * conditions of the GNU General Public License cover the whole
+ * combination.
+ *
+ * As a special exception, the copyright holders of this library give you
+ * permission to link this library with independent modules to produce an
+ * executable, regardless of the license terms of these independent
+ * modules, and to copy and distribute the resulting executable under terms
+ * of your choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module. An
+ * independent module is a module which is not derived from or based on
+ * this library. If you modify this library, you may extend this exception
+ * to your version of the library, but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version.
+ *
+ * Please refer to the file LICENSE for details.
+ */
+package jvm;
+
+/**
+ * @author Tomasz Grabiec
+ */
+public class ObjectCreationAndManipulationExceptionsTest extends TestCase {
+ public int field;
+
+ public static void testGetfieldThrowsNullPointerException() {
+ boolean caught = false;
+ ObjectCreationAndManipulationExceptionsTest test = null;
+
+ try {
+ takeInt(test.field);
+ } catch (NullPointerException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void testPutfieldThrowsNullPointerException() {
+ boolean caught = false;
+ ObjectCreationAndManipulationExceptionsTest test = null;
+
+ try {
+ test.field = 1;
+ } catch (NullPointerException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void testCheckcastThrowsClassCastException() {
+ boolean caught = false;
+ Object o = null;
+ String s = null;
+
+ try {
+ s = (String)o;
+ } catch (ClassCastException e) {
+ caught = true;
+ }
+
+ assertFalse(caught);
+
+ o = new Object();
+
+ try {
+ s = (String)o;
+ } catch (ClassCastException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+
+ takeObject(s);
+ }
+
+ public static void main(String args[]) {
+ testGetfieldThrowsNullPointerException();
+ testPutfieldThrowsNullPointerException();
+ testCheckcastThrowsClassCastException();
+
+ exit();
+ }
+}
\ No newline at end of file
diff --git a/regression/jvm/SynchronizationExceptionsTest.java
b/regression/jvm/SynchronizationExceptionsTest.java
new file mode 100644
index 0000000..e009ec0
--- /dev/null
+++ b/regression/jvm/SynchronizationExceptionsTest.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2009 Tomasz Grabiec
+ *
+ * This file is released under the GPL version 2 with the following
+ * clarification and special exception:
+ *
+ * Linking this library statically or dynamically with other modules is
+ * making a combined work based on this library. Thus, the terms and
+ * conditions of the GNU General Public License cover the whole
+ * combination.
+ *
+ * As a special exception, the copyright holders of this library give you
+ * permission to link this library with independent modules to produce an
+ * executable, regardless of the license terms of these independent
+ * modules, and to copy and distribute the resulting executable under terms
+ * of your choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module. An
+ * independent module is a module which is not derived from or based on
+ * this library. If you modify this library, you may extend this exception
+ * to your version of the library, but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version.
+ *
+ * Please refer to the file LICENSE for details.
+ */
+package jvm;
+
+/**
+ * @author Tomasz Grabiec
+ */
+public class SynchronizationExceptionsTest extends TestCase {
+ public static void testMonitorenterThrowsNullPointerException() {
+ boolean caught = false;
+ Object mon = null;
+
+ try {
+ synchronized(mon) {
+ takeInt(1);
+ }
+ } catch (NullPointerException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+ }
+
+ public static void main(String args[]) {
+ testMonitorenterThrowsNullPointerException();
+ /* TODO: testMonitorexit() */
+
+ exit();
+ }
+}
\ No newline at end of file
diff --git a/regression/run-suite.sh b/regression/run-suite.sh
index b0b564f..7dfdc9e 100755
--- a/regression/run-suite.sh
+++ b/regression/run-suite.sh
@@ -74,6 +74,12 @@ if [ -z "$CLASS_LIST" ]; then
run_java jvm.FibonacciTest 0
run_java jvm.StringTest 0
run_java jvm.PrintTest 0
+ run_java jvm.ArrayExceptionsTest 0
+ run_java jvm.IntegerArithmeticExceptionsTest 0
+ run_java jvm.LongArithmeticExceptionsTest 0
+ run_java jvm.MethodInvocationExceptionsTest 0
+ run_java jvm.ObjectCreationAndManipulationExceptionsTest 0
+ run_java jvm.SynchronizationExceptionsTest 0
else
for i in $CLASS_LIST; do
run_java $i 0
--
1.6.0.6
------------------------------------------------------------------------------
_______________________________________________
Jatovm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel