Index: src/test/regression/H2103/Test.java =================================================================== --- src/test/regression/H2103/Test.java (revision 0) +++ src/test/regression/H2103/Test.java (revision 0) @@ -0,0 +1,29 @@ +package org.apache.harmony.drlvm.tests.regression.h2103; + +import junit.framework.TestCase; + +/** + * Loads class and tries to invoke a method which should fail + * verification. + * + * SubClass contains an incorrect invokespecial instruction which invokes + * a method from a subclass of the current class, while only superclass + * constructors can be called using this instruction. + */ +public class Test extends TestCase { + public static void main(String args[]) { + (new Test()).test(); + } + + public void test() { + try { + SupClass.test(); + } catch (VerifyError ve) { + return; + } catch (Exception e) { + } + fail("A method of SupClass class should throw VerifyError"); + } +} + + Index: src/test/regression/H2103/SupClass.j =================================================================== --- src/test/regression/H2103/SupClass.j (revision 0) +++ src/test/regression/H2103/SupClass.j (revision 0) @@ -0,0 +1,19 @@ +.class public org/apache/harmony/drlvm/tests/regression/h2103/SupClass +.super java/lang/Object + +.method public ()V + aload_0 + invokespecial java/lang/Object/()V + return +.end method + +.method public static test()I + .limit locals 3 + .limit stack 3 + new org/apache/harmony/drlvm/tests/regression/h2103/SubClass + dup + invokespecial org/apache/harmony/drlvm/tests/regression/h2103/SubClass/()V + invokespecial org/apache/harmony/drlvm/tests/regression/h2103/SubClass/mth()I + ireturn +.end method + Index: src/test/regression/H2103/SubClass.j =================================================================== --- src/test/regression/H2103/SubClass.j (revision 0) +++ src/test/regression/H2103/SubClass.j (revision 0) @@ -0,0 +1,17 @@ +.class public org/apache/harmony/drlvm/tests/regression/h2103/SubClass +.super org/apache/harmony/drlvm/tests/regression/h2103/SupClass + +.method public ()V + aload_0 + invokespecial org/apache/harmony/drlvm/tests/regression/h2103/SupClass/()V + return +.end method + +.method public test()I + .limit locals 2 + .limit stack 2 + sipush 105 + ireturn +.end method + +