harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Elena Sayapina (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-3908) [drlvm] Drlvm crashes on Method.invoke(obj, {arg}) if arg extends Number instead of expected primitive type wrapper
Date Fri, 18 May 2007 09:33:16 GMT
[drlvm] Drlvm crashes on Method.invoke(obj, {arg}) if arg extends Number instead of expected
primitive type wrapper
-------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-3908
                 URL: https://issues.apache.org/jira/browse/HARMONY-3908
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
            Reporter: Elena Sayapina


Drlvm crashes in primitives support if call invoke() method with wrong argument: 
Argument is object of a class extends Number instead of expected object of primitive type
wrapper.

Please, consider the following code:

import java.lang.reflect.Method;

public class invokeTest {

	byte b = 0;
	
	public static void main(String[] args) {
	    try {
	    	Method method = invokeTest.class.getDeclaredMethod("test", new Class[] {Byte.TYPE});
	    	method.invoke(new invokeTest(), new Object[] {new N()}); 
	    	System.out.println("TEST FAILED: no exception");
	    } catch(IllegalArgumentException e) {
	    	System.out.println("TEST PASSED: " + e);
	    } catch(Exception e) {
	    	System.out.println("TEST FAILED: unexpected " + e);
	    }
	}
	
	public void test(byte b) {
    	this.b = b;
    }
}

class N extends Number {
	
	public double doubleValue() { 
		return 0; 
	}
	
	public float floatValue() { 
		return 0;
	}

	public int intValue() {
		return 0;
	}

	public long longValue() {
		return 0;
	}
}

Output on Harmony-r539255:

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 = r539255, (May 18 2007), Windows/ia32/msvc 1310, release build
http://incubator.apache.org/harmony

Internal error:C:\BT\build\checkouts\drlvm\vm\vmcore\src\jit\primitives_support.cpp:320: Unknown
type descriptor

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

 
Output on HotSpot:

java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)

TEST PASSED: java.lang.IllegalArgumentException: argument type mismatch


Please, NOTE that if N doesn't extend any class or extends some class other than Number the
test passes.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message