Skip to content

Instantly share code, notes, and snippets.

@capeterson
Last active August 29, 2015 14:13
Show Gist options
  • Save capeterson/9e88b1f710fdb88dd44f to your computer and use it in GitHub Desktop.
Save capeterson/9e88b1f710fdb88dd44f to your computer and use it in GitHub Desktop.
public class OhGodBees extends Exception{}
//fails: OhGodBees: Classes extending Exception must have a name ending in 'Exception'
public class BeesException extends Exception{
public BeesException(){}
}
//fails: System exception constructor already defined: <Constructor>()
public class BeesException extends Exception{
public BeesException(String message, Boolean noop){
this.setMessage(message);
}
public void setMessage(String message){
super.setMessage(message);
}
}
//fails: BeesException: Method must use the override keyword: void setMessage(String)
public class BeesException extends Exception{
public BeesException(String message, Boolean noop){
this.setMessage(message);
}
public override void setMessage(String message){
super.setMessage(message);
}
}
//fails: Object has no superclass for super invocation
public class BeesException extends Exception{
public BeesException(String message){
this.setMessage(message);
}
}
//fails: System exception constructor already defined: <Constructor>(String)
public virtual class AnException extends Exception{}
public class BeesException extends AnException{
public BeesException(String message, Boolean noop){
this.setMessage(message);
}
public override void setMessage(String message){
super.setMessage(message);
}
}
//works, but not how you'd think
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment