I am writing a constructor for my "main" class. The first thing he does is invoke a method to use commons-cli to parse the command line. If the parseOptions method returns false, an error has occurred and the constructor should exit.
I tried to write the following code
if (!parseOptions(args)) return
but the compiler complains that I have a definition of "Definition of an External Operator".
The call to System.exit(1) ends or inverts the boolean value (and puts the rest of my logic in the if , is there any way to return the βearlyβ from the constructor?
I believe that the parseOptions method could throw an IllegalArgumentException and catch it in my Main object.
Thanks.
constructor scala exit
Ralph
source share