harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vera Petrashkova (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2099) [drlvm][jit] Jitrino/OPT does not reject class with incorrect instance initialization method
Date Wed, 08 Nov 2006 07:04:50 GMT
[drlvm][jit] Jitrino/OPT does not reject class with incorrect instance initialization method
--------------------------------------------------------------------------------------------

                 Key: HARMONY-2099
                 URL: http://issues.apache.org/jira/browse/HARMONY-2099
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
         Environment: Windows and Linux
            Reporter: Vera Petrashkova


According to J2SE VM specifications each instance initialization method except for 
the instance initialization method directed from the constructor of class Object 
must call 
    - either another instance initialization method of this 
    - an instance initialization method of its direct superclass.

But Jitrino/OPT does not reject class when its instance initialization method invokes initialization
method of 
some class which is not superclass of this class.

The following initTest reproduces the issue. It uses wrongInit class which was created
from jasmin source code. 
------------------initTest.java------------------
public class initTest { 
    public static void main(String[] args) throws Exception { 
        System.out.println("wrongInit class");
        try {
             new wrongInit();             
             System.out.println("Test fails");
        } catch (VerifyError e ) {
            System.out.println("Test passes. Expected error was thrown: "+e);
        } catch (Throwable e ) {
            System.out.println("Test fails: unexpected error");
            e.printStackTrace(System.out);
        }   
    }
}

class initTest_1 {
}
------------------------wrongInit.jj--------------------------
.class public wrongInit
.super initTest_1
;
; initializer
.method public <init>()V
   aload_0
; invoke <init> method from incorrect class
   invokespecial java/lang/Object/<init>()V 
   return
.end method
----------------------------------------------------
Create wrongInit class 
java -jar jasmin.jar wrongInit.jj

or use class file from attachment


Output on Harmony (Interpreter and Jitrino/JET)
================================
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
http://incubator.apache.org/harmony
wrongInit class
Test passes. Expected error was thrown: java.lang.VerifyError: (class: wrongInit, method:
<init>()V) Call to wrong initialization method


Output on Harmony (Jitrino/OPT)
==============================
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
http://incubator.apache.org/harmony
wrongInit class
Test fails


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message