Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » usinng System.exit() still requires return...
usinng System.exit() still requires return... [message #257348] Thu, 13 November 2008 07:56 Go to next message
Eclipse UserFriend
Originally posted by: Michiel.Kamermans.icis.decis.nl

Hi,

I noticed that eclipse does not detect that when I issue a System.exit(int)
call, any following code is unreachable, so if I stick it in a method with a
return type that isn't "void" it complains that my method is missing a return
statement.

Is this an option that can be user-set, or is it just a (for the moment)
shortcoming in the Eclipse java parser?

regards,

- Mike Kamermans
Re: usinng System.exit() still requires return... [message #257352 is a reply to message #257348] Thu, 13 November 2008 08:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Kevin.REMOVE.Dean.datadevelopment.com

Mike Kamermans wrote:

>I noticed that eclipse does not detect that when I issue a System.exit(int)
>call, any following code is unreachable, so if I stick it in a method with
>a
>return type that isn't "void" it complains that my method is missing a
>return
>statement.
>
>Is this an option that can be user-set, or is it just a (for the moment)
>shortcoming in the Eclipse java parser?

System.exit(int) is just another function call. The fact that it
terminates the VM is not something that is in any way relevant to the
parser. Every function is assumed to return regardless of what happens at
runtime, and so the flow of your code requires that all paths have
completed return statements.
Re: usinng System.exit() still requires return... [message #257356 is a reply to message #257348] Thu, 13 November 2008 09:18 Go to previous message
Eclipse UserFriend
Mike Kamermans a écrit :
> Is this an option that can be user-set, or is it just a (for the moment)
> shortcoming in the Eclipse java parser?
This has nothing to do with Eclipse. System.exit() has no special
meaning in the JLS.
Try with javac and you will get the same result.
--
Olivier
Previous Topic:disable line wrapping in formatter
Next Topic:Code templates in conditional breakpoints
Goto Forum:
  


Current Time: Thu Apr 17 21:28:50 EDT 2025

Powered by FUDForum. Page generated in 0.03843 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top