150151152153154155156157158159160
public void validate() { int n=types.length; if (n<2) throw new KissException("Union must have at least two members"); for (int i=0; i<n; i++) { Type t=types[i]; t.validate(); if (t instanceof Nothing) throw new KissException(this+ " should not contain Nothing type"); } } @Override
153154155156157158159160161162163
public void validate() { int n=types.length; if (n<2) throw new KissException("Intersection must have at least two members"); for (int i=0; i<n; i++) { Type t=types[i]; t.validate(); if (t instanceof Anything) throw new KissException(this+ " should not contain Anything"); } } }