Fix opcode tests for sput_object

Bug 3147582

Change-Id: I7437599a75161b419f82852ed857c52efaf19dc5
diff --git a/tools/vm-tests/src/dot/junit/opcodes/sput_object/Test_sput_object.java b/tools/vm-tests/src/dot/junit/opcodes/sput_object/Test_sput_object.java
index 0607225..cd070a7 100644
--- a/tools/vm-tests/src/dot/junit/opcodes/sput_object/Test_sput_object.java
+++ b/tools/vm-tests/src/dot/junit/opcodes/sput_object/Test_sput_object.java
@@ -19,10 +19,16 @@
 import dot.junit.DxTestCase;
 import dot.junit.DxUtil;
 import dot.junit.opcodes.sput_object.d.T_sput_object_1;
+import dot.junit.opcodes.sput_object.d.T_sput_object_10;
 import dot.junit.opcodes.sput_object.d.T_sput_object_11;
 import dot.junit.opcodes.sput_object.d.T_sput_object_12;
 import dot.junit.opcodes.sput_object.d.T_sput_object_13;
 import dot.junit.opcodes.sput_object.d.T_sput_object_14;
+import dot.junit.opcodes.sput_object.d.T_sput_object_15;
+import dot.junit.opcodes.sput_object.d.T_sput_object_17;
+import dot.junit.opcodes.sput_object.d.T_sput_object_7;
+import dot.junit.opcodes.sput_object.d.T_sput_object_8;
+import dot.junit.opcodes.sput_object.d.T_sput_object_9;
 
 public class Test_sput_object extends DxTestCase {
     /**
@@ -35,7 +41,7 @@
         assertEquals(t, T_sput_object_1.st_i1);
     }
 
- 
+
     /**
      * @title modification of final field
      */
@@ -57,7 +63,7 @@
         t.run();
         assertEquals(t, T_sput_object_14.getProtectedField());
     }
-  
+
 
     /**
      * @title initialization of referenced class throws exception
@@ -86,8 +92,8 @@
     }
 
     /**
-     * 
-     * @constraint A23 
+     *
+     * @constraint A23
      * @title number of registers
      */
     public void testVFE2() {
@@ -101,25 +107,24 @@
 
 
     /**
-     * 
-     * @constraint B13 
-     * @title put object into long field - only field with same name but 
+     *
+     * @constraint B13
+     * @title put object into long field - only field with same name but
      * different type exists
      */
     public void testVFE5() {
         try {
-            Class.forName("dot.junit.opcodes.sput_object.d.T_sput_object_17");
-            fail("expected a verification exception");
-        } catch (Throwable t) {
-            DxUtil.checkVerifyException(t);
+            new T_sput_object_17().run();
+            fail("expected NoSuchFieldError");
+        } catch (NoSuchFieldError t) {
         }
     }
-    
+
 
     /**
-     * 
-     * @constraint B13 
-     * @title type of field doesn't match opcode - attempt to modify double 
+     *
+     * @constraint B13
+     * @title type of field doesn't match opcode - attempt to modify double
      * field with single-width register
      */
     public void testVFE7() {
@@ -130,87 +135,77 @@
             DxUtil.checkVerifyException(t);
         }
     }
-    
+
     /**
-     * 
-     * @constraint A12 
-     * @title Attempt to set non-static field. Java throws IncompatibleClassChangeError 
-     * on first access but Dalvik throws VerifyError on class loading.
+     *
+     * @constraint A12
+     * @title Attempt to set non-static field.
      */
     public void testVFE8() {
          try {
-             Class.forName("dot.junit.opcodes.sput_object.d.T_sput_object_7");
-             fail("expected a verification exception");
-         } catch (Throwable t) {
-             DxUtil.checkVerifyException(t);
+             new T_sput_object_7().run();
+             fail("expected IncompatibleClassChangeError");
+         } catch (IncompatibleClassChangeError t) {
          }
     }
-    
+
     /**
      * @constraint n/a
-     * @title Attempt to modify inaccessible field. Java throws IllegalAccessError 
-     * on first access but Dalvik throws VerifyError on class loading.
+     * @title Attempt to modify inaccessible field.
      */
     public void testVFE9() {
         //@uses dot.junit.opcodes.sput_object.TestStubs
         //@uses dot.junit.opcodes.sput_object.d.T_sput_object_8
         try {
-            Class.forName("dot.junit.opcodes.sput_object.d.T_sput_object_8");
-            fail("expected a verification exception");
-        } catch (Throwable t) {
-            DxUtil.checkVerifyException(t);
+            new T_sput_object_8().run();
+            fail("expected IllegalAccessError");
+        } catch (IllegalAccessError t) {
         }
     }
 
     /**
      * @constraint n/a
-     * @title Attempt to modify field of undefined class. Java throws NoClassDefFoundError 
-     * on first access but Dalvik throws VerifyError on class loading.
+     * @title Attempt to modify field of undefined class.
      */
     public void testVFE10() {
         try {
-            Class.forName("dot.junit.opcodes.sput_object.d.T_sput_object_9");
-            fail("expected a verification exception");
-        } catch (Throwable t) {
-            DxUtil.checkVerifyException(t);
+            new T_sput_object_9().run();
+            fail("expected NoClassDefFoundError");
+        } catch (NoClassDefFoundError t) {
         }
     }
 
     /**
      * @constraint n/a
-     * @title Attempt to modify undefined field. Java throws NoSuchFieldError 
-     * on first access but Dalvik throws VerifyError on class loading.
+     * @title Attempt to modify undefined field.
      */
     public void testVFE11() {
         try {
-            Class.forName("dot.junit.opcodes.sput_object.d.T_sput_object_10");
-            fail("expected a verification exception");
-        } catch (Throwable t) {
-            DxUtil.checkVerifyException(t);
+            new T_sput_object_10().run();
+            fail("expected NoSuchFieldError");
+        } catch (NoSuchFieldError t) {
         }
     }
-    
-    
-    
+
+
+
     /**
      * @constraint n/a
-     * @title Attempt to modify superclass' private field from subclass. Java 
-     * throws IllegalAccessError on first access but Dalvik throws VerifyError on class loading.
+     * @title Attempt to modify superclass' private field from subclass.
      */
     public void testVFE12() {
         //@uses dot.junit.opcodes.sput_object.d.T_sput_object_1
         //@uses dot.junit.opcodes.sput_object.d.T_sput_object_15
         try {
-            Class.forName("dot.junit.opcodes.sput_object.d.T_sput_object_15");
+            new T_sput_object_15().run();
             fail("expected a verification exception");
-        } catch (Throwable t) {
-            DxUtil.checkVerifyException(t);
+        } catch (IllegalAccessError t) {
         }
     }
-    
-    
+
+
     /**
-     * @constraint B1 
+     * @constraint B1
      * @title sput-object shall not work for wide numbers
      */
     public void testVFE13() {
@@ -221,10 +216,10 @@
             DxUtil.checkVerifyException(t);
         }
     }
-    
+
     /**
-     * 
-     * @constraint B13 
+     *
+     * @constraint B13
      * @title assignment incompatible references
      */
     public void testVFE14() {
@@ -235,10 +230,10 @@
             DxUtil.checkVerifyException(t);
         }
     }
-    
+
     /**
-     * 
-     * @constraint B1 
+     *
+     * @constraint B1
      * @title sput-object shall not work for char fields
      */
     public void testVFE15() {
@@ -249,10 +244,10 @@
             DxUtil.checkVerifyException(t);
         }
     }
-    
+
     /**
-     * 
-     * @constraint B1 
+     *
+     * @constraint B1
      * @title sput-object shall not work for int fields
      */
     public void testVFE16() {
@@ -263,10 +258,10 @@
             DxUtil.checkVerifyException(t);
         }
     }
-    
+
     /**
-     * 
-     * @constraint B1 
+     *
+     * @constraint B1
      * @title sput-object shall not work for byte fields
      */
     public void testVFE17() {
@@ -277,10 +272,10 @@
             DxUtil.checkVerifyException(t);
         }
     }
-    
+
     /**
-     * 
-     * @constraint B1 
+     *
+     * @constraint B1
      * @title sput-object shall not work for boolean fields
      */
     public void testVFE18() {
@@ -293,8 +288,8 @@
     }
 
     /**
-     * 
-     * @constraint B1 
+     *
+     * @constraint B1
      * @title sput-object shall not work for short fields
      */
     public void testVFE6() {
@@ -308,17 +303,16 @@
 
 
     /**
-     * @constraint B1 
+     * @constraint B1
      * @title Modification of final field in other class
      */
     public void testVFE19() {
         //@uses dot.junit.opcodes.sput_object.TestStubs
         //@uses dot.junit.opcodes.sput_object.d.T_sput_object_11
     	try {
-            Class.forName("dot.junit.opcodes.sput_object.d.T_sput_object_11");
-            fail("expected a verification exception");
-        } catch (Throwable t) {
-            DxUtil.checkVerifyException(t);
+            new T_sput_object_11().run();
+            fail("expected IllegalAccessError");
+        } catch (IllegalAccessError t) {
         }
     }
 }
diff --git a/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_10.java b/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_10.java
new file mode 100644
index 0000000..bbc15c5
--- /dev/null
+++ b/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_10.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dot.junit.opcodes.sput_object.d;
+
+public class T_sput_object_10 {
+    public void run() {
+    }
+}
diff --git a/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_15.java b/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_15.java
new file mode 100644
index 0000000..676e4c3
--- /dev/null
+++ b/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_15.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dot.junit.opcodes.sput_object.d;
+
+public class T_sput_object_15 {
+    public void run() {
+    }
+}
diff --git a/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_17.java b/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_17.java
new file mode 100644
index 0000000..6f7ad7c
--- /dev/null
+++ b/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_17.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dot.junit.opcodes.sput_object.d;
+
+public class T_sput_object_17 {
+    public void run() {
+    }
+}
diff --git a/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_7.java b/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_7.java
new file mode 100644
index 0000000..0e5f873
--- /dev/null
+++ b/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_7.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dot.junit.opcodes.sput_object.d;
+
+public class T_sput_object_7 {
+    public void run() {
+    }
+}
diff --git a/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_8.java b/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_8.java
new file mode 100644
index 0000000..d3d7408
--- /dev/null
+++ b/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_8.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dot.junit.opcodes.sput_object.d;
+
+public class T_sput_object_8 {
+    public void run() {
+    }
+}
diff --git a/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_9.java b/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_9.java
new file mode 100644
index 0000000..bef9d16
--- /dev/null
+++ b/tools/vm-tests/src/dot/junit/opcodes/sput_object/d/T_sput_object_9.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dot.junit.opcodes.sput_object.d;
+
+public class T_sput_object_9 {
+    public void run() {
+    }
+}