Added test cases for explicitly declaring methods and constructors with exceptions and fixed some bugs related to this.