This is the mail archive of the
mauve-discuss@sources.redhat.com
mailing list for the Mauve project.
Re: FW: Question about Java Lang testcaseJAVA.LANG.REFLECT.ARRAY.NEGATIVEARRAYSIZEEXCEPTION
- From: Eric Blake <ebb9 at email dot byu dot edu>
- To: Patrick Ellis <Patrick dot Ellis at sas dot com>
- Cc: mauve-discuss <mauve-discuss at sources dot redhat dot com>
- Date: Tue, 08 Apr 2003 08:30:01 -0600
- Subject: Re: FW: Question about Java Lang testcaseJAVA.LANG.REFLECT.ARRAY.NEGATIVEARRAYSIZEEXCEPTION
- References: <F2E670D5036BE14E89473A3FAEDE6ACE0280680F@merc18.na.sas.com>
More quotes from Sun (by the way, I was the submitter of the bug you
quote from, 4433326):
http://developer.java.sun.com/developer/bugParade/bugs/4433326.html
FWIW, this contradicts the JVMS and the JLS. So it is a bug.
I doubt if it makes a big difference to anyone either way, but the KVM
behaves differently (and for once, they're right).
xxxxx at xxxxx 2002-07-31
http://developer.java.sun.com/developer/bugParade/bugs/4723534.html
I read that to say that all the dimension expressions are evaluated
first, and the only problems noted at this point are expressions that
cannot be evaluated. I do not think that an expression evaluating to
zero can be considered to have completed abruptly. Then *all* the
evaluated dimension values are checked to be nonnegative, and only
after that is space allocated for the new array. I don't see any way
to argue that encountering a zero dimension should terminate the
checking for nonnegative values. But is the case that, as described,
encountering a zero dimension when allocating terminates allocation of the
subarrays. So I conclude that KVM is right, and the test and HotSpot
are wrong!
Unfortunately, this gets us back to a variant of the philosophical
problem: the JLS appears to conflict with a longstanding behavior.
This might turn into something that Gilad and I have to worry about
resolving somehow, and it's possible that resolution would mean
deciding that the spec is in fact in error. But in the meanwhile I
don't think you have a bug.
-- Tim
Patrick Ellis wrote:
Eric,
I forgot to include a comment made by Sun.
This is a comment from one of our designers ......
I think this is a gray area that would be classified as "interpretation of the spec.". All the vendors get the same spec to implement, but the interpretation of things not explicitly stated varies. This would probably fall into that category, but in the bug that was submitted to Sun (about two years ago) that is pretty much the exact same example you have in your code, Sun stated that they do not consider this to be a bug. There are lots of cases where IBM and other vendors have tightened up the functionality over and above what the spec states as being required.
From Sun:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"The first array element is zero size therefore we silently discontinue evaluating next array element size. This will not be fixed. This is not a bug. If user puts [1][-1] an exception will be thrown as desired and spec'd. Closing as a will not fix. xxxxx at xxxxx 2002-04-08"
--
This signature intentionally left boring.
Eric Blake ebb9 at email dot byu dot edu
BYU student, free software programmer