StackOverflowError

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

StackOverflowError

Pedro Izecksohn
  May this list be the wrong place to discuss it, but:

  The following code is not a Mauve compatibility test, but it does work different between Sun Microsystems' Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode) and gij (GNU libgcj) version 4.2.1 (Debian 4.2.1-5).

pedro@pentiumd:~/programming/java/recursive$ java Recursive
Successfully recursed 16286.
pedro@pentiumd:~/programming/java/recursive$ gij Recursive
Segmentation fault

public class Recursive {

static int nTimes=0;

public static void main (String [] args) {

Thread t = new Thread (new Runnable () {

public void run () {

recurse();

} // run ()

private void recurse () {

Recursive.nTimes++;

try {recurse();} catch (StackOverflowError soe) {}

} // recurse ()

} // Runnable

); // new Thread

t.start();
try {t.join();} catch (InterruptedException ie) {}

System.out.println ("Successfully recursed "+nTimes+".");

} // main (String [])

} // Recursive





      ____________________________________________________________________________________
Shape Yahoo! in your own image.  Join our Network Research Panel today!   http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 


Reply | Threaded
Open this post in threaded view
|

Re: StackOverflowError

Dalibor Topic
Pedro Izecksohn wrote:
>   May this list be the wrong place to discuss it, but:
>

Hi Pedro,

You'd have a better chance of reaching gcj developers by using the gcj
mailing list. Or its bugtracker.

cheers,
dalibor topic
Reply | Threaded
Open this post in threaded view
|

Re: StackOverflowError

Pedro Izecksohn
In reply to this post by Pedro Izecksohn
>> May this list be the wrong place to discuss it, but:

> You'd have a better chance of reaching gcj developers by using the gcj
> mailing list. Or its bugtracker.

  I forgot to ask:

  Must a conforming JVM enable applications to catch all java.lang.Error subclasses?

  If the answer is yes, Mauve should include such tests.






       
____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online.
http://smallbusiness.yahoo.com/webhosting
Reply | Threaded
Open this post in threaded view
|

Re: StackOverflowError

Dalibor Topic
Pedro Izecksohn wrote:
>>> May this list be the wrong place to discuss it, but:
>
>> You'd have a better chance of reaching gcj developers by using the gcj
>> mailing list. Or its bugtracker.
>
>   I forgot to ask:
>
>   Must a conforming JVM enable applications to catch all java.lang.Error subclasses?
>

Afaict, no. Consider VirtualMachineError or InternalError. See also the
JVM spec:

"The class Error and its standard subclasses are exceptions from which
ordinary programs are not ordinarily expected to recover. The class
Error is a separate subclass of Throwable, distinct from Exception in
the class hierarchy, in order to allow programs to use the idiom

        } catch (Exception e) {

to catch all exceptions from which recovery may be possible without
catching errors from which recovery is typically not possible. "

cheers,
dalibor topic