WizardPopup (WizardPopup parent, PopupStep step, Object parentValue) { if (step instanceof MyBasePopupState) { //noinspection unchecked return new ComboBoxPopup<>(myContext, parent, (MyBasePopupState<T>)step, parentValue); } throw new IllegalArgumentException(step.getClass().toString()); }