Skip to content

Instantly share code, notes, and snippets.

@jangalinski
Created April 1, 2013 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jangalinski/5283991 to your computer and use it in GitHub Desktop.
Save jangalinski/5283991 to your computer and use it in GitHub Desktop.
public class FactoryThatThrowsException {
// a String creation Factory/Builder ...
public static String getString() throws Exception {
throw new Exception();
}
// normally would not compile
private final String aString = getString();
// but does as long the constructor throws the exception
public FactoryThatThrowsException() throws Exception {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment