@Test @DisplayName("prohibit obtaining B when A is set") void notGetBForA() { assertThrows(IllegalStateException.class, () -> eitherWithA.getB()); }
@Override public B getB() { return get(this, 1); }
EitherOf2 extends Either implements AValue<A>, BValue<B> { @Override public B getB() { return get(this, 1); } }
EitherOf2 extends Either implements AValue<A>, BValue<B> { @Override public B getB() { return get(this, 1); } private  EitherOf2(Message value, int index); }
EitherOf2 extends Either implements AValue<A>, BValue<B> { @Override public B getB() { return get(this, 1); } private  EitherOf2(Message value, int index); static EitherOf2<A, B> withA(A a); static EitherOf2<A, B> withB(B b); @Override A getA(); @Override B getB(); }
EitherOf2 extends Either implements AValue<A>, BValue<B> { @Override public B getB() { return get(this, 1); } private  EitherOf2(Message value, int index); static EitherOf2<A, B> withA(A a); static EitherOf2<A, B> withB(B b); @Override A getA(); @Override B getB();  }