[classlib][beans] differences in java.beans.Statement behavior
--------------------------------------------------------------
Key: HARMONY-882
URL: http://issues.apache.org/jira/browse/HARMONY-882
Project: Harmony
Issue Type: Bug
Components: Non-bug differences from RI
Environment: winXP
Reporter: Alexei Zakharov
Priority: Minor
While trying to enable tests from
org.apache.harmony.beans.tests.java.beans.StatementTest I have faced
the strange problem. It seems that while building Statement for
accessing array elements RI doesn't check the number of parameters of
get() method. It simply takes the value of first argument, converts it
to integer and does nothing more. Following (IMHO invalid) tests pass
on RI:
Test1:
Object[] array = new Object[] { "test" };
Statement t = new Statement(array, "get", new Object[] {
new Integer(0), new Object() });
t.execute();
Test2:
Object[] array = new Object[] { "test" };
Statement t = new Statement(array, "get", new Object[] {
new Integer(0), new Object(), new Integer[] {1,2,3,4,5,6},
new java.util.GregorianCalendar(), "mama mila ramu" });
t.execute();
The spec states the following:
"The method names 'get' and 'set' defined in the java.util.List
interface may also be applied to array instances, mapping to the
static methods of the same name in the Array class."
Therefore, since java.util.List defines 'get' method with excatly one
integer argument I suppose the correct test should look like:
Test3:
Object[] array = new Object[] { "test" };
Statement t = new Statement(array, "get", new Object[] {
new Integer(0) });
t.execute();
And Test1 and Test2 should throw NoSuchMethodException as our
implementation does.
So, the behavior of our implementation differs from RI. But RI's behavior looks unnatural in this case. It was decided [1] we should keep our behavior.
[1] http://mail-archives.apache.org/mod_mbox/incubator-harmony-dev/200607.mbox/%3c44B3DDE8.1020904@gmail.com%3e
--
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