public inbox for mauve-discuss@sourceware.org
 help / color / mirror / Atom feed
* FW: Question about Java Lang testcase JAVA.LANG.REFLECT.ARRAY.NEGATIVEARRAYSIZEEXCEPTION
@ 2003-04-07 20:32 Patrick Ellis
  2003-04-08 12:07 ` Eric Blake
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Ellis @ 2003-04-07 20:32 UTC (permalink / raw)
  To: mauve-discuss@sources.redhat.com



Pat Ellis
SDE Build and Test Team
Phone:      (919) 531-0355   
R2263     Patrick.Ellis@sas.com
SAS...  The Power to Know

>  -----Original Message-----
> From: 	Patrick Ellis  
> Sent:	Monday, April 07, 2003 4:31 PM
> To:	'mauve-discuss@sources.redhat.com'
> Subject:	Question about Java Lang testcase JAVA.LANG.REFLECT.ARRAY.NEGATIVEARRAYSIZEEXCEPTION
> 
> 
> Question about JAVA.LANG.REFLECT.ARRAY.NEGATIVEARRAYSIZEEXCEPTION. This is part of the testcase in java.lang. 
> 
>     int val = 0;
>       Object x = null;
>       val = 0;
>       try
>         {
>           x = new int[0][-1];
>           val = 1;
>         }
>       catch (NegativeArraySizeException e)
>         {
>           val = 2;
>           e.printStackTrace(System.out);
> 
>         }
> 
> the testcase should throw an NegativeArraySizeException but because the negative -1 is the second element and 0 is the first element 
> some JVMs fail to throw the exception. Should the testcase be changed from  x = new int[0][-1]; -----> x = new int[1][-1];
> 
> 
> Pat Ellis
> SDE Build and Test Team
> Phone:      (919) 531-0355   
> R2263     Patrick.Ellis@sas.com
> SAS...  The Power to Know
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FW: Question about Java Lang testcase JAVA.LANG.REFLECT.ARRAY.NEGATIVEARRAYSIZEEXCEPTION
  2003-04-07 20:32 FW: Question about Java Lang testcase JAVA.LANG.REFLECT.ARRAY.NEGATIVEARRAYSIZEEXCEPTION Patrick Ellis
@ 2003-04-08 12:07 ` Eric Blake
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Blake @ 2003-04-08 12:07 UTC (permalink / raw)
  To: Patrick Ellis; +Cc: mauve-discuss

No. Sun admits that their VM is buggy for not throwing the exception in 
this case (search their BugParade database).

Patrick Ellis wrote:
>>the testcase should throw an NegativeArraySizeException but because the negative -1 is the second element and 0 is the first element 
>>some JVMs fail to throw the exception. Should the testcase be changed from  x = new int[0][-1]; -----> x = new int[1][-1];
-- 
This signature intentionally left boring.

Eric Blake             ebb9@email.byu.edu
   BYU student, free software programmer


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FW: Question about Java Lang testcase JAVA.LANG.REFLECT.ARRAY.NEGATIVEARRAYSIZEEXCEPTION
       [not found] <F2E670D5036BE14E89473A3FAEDE6ACE0280680F@merc18.na.sas.com>
@ 2003-04-08 14:29 ` Eric Blake
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Blake @ 2003-04-08 14:29 UTC (permalink / raw)
  To: Patrick Ellis; +Cc: mauve-discuss

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@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@xxxxx 2002-04-08"
> 

-- 
This signature intentionally left boring.

Eric Blake             ebb9@email.byu.edu
   BYU student, free software programmer


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-04-08 14:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-07 20:32 FW: Question about Java Lang testcase JAVA.LANG.REFLECT.ARRAY.NEGATIVEARRAYSIZEEXCEPTION Patrick Ellis
2003-04-08 12:07 ` Eric Blake
     [not found] <F2E670D5036BE14E89473A3FAEDE6ACE0280680F@merc18.na.sas.com>
2003-04-08 14:29 ` Eric Blake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).