I wanna define an interface, like
public interface Visitor <ArgType, ResultType, SelfDefinedException> {
public ResultType visitProgram(Program prog, ArgType arg) throws SelfDefinedException;
//...
}
during implementation, selfDefinedException varies. (selfDefinedException as a generic undefined for now)
Is there a way to do this?
Thanks
You just need to constrain the exception type to be suitable to be thrown. For example:
Or perhaps: