Closed danielkaneider closed 9 years ago
This problem couldn't be solved while maintaining backward compatibility.
It may work to cast the null:
setInSlot(A_NESTED_SLOT, (NestedSlot) null)
but otherwise it's not calling the type safe method I think.
So use clearSlot for now and then we can fix this when we drop support for the old slots.
The problem arises when firing a RevealContentEvent with null
. I don't think the problem is the wrong mapping of the setInSlot
method, but rather what is happening inside the new setInSlot
method.
Adding RemovableSlot
to NestedSlot
should solve the problem, if that is the intended behaviour.
I don't have the gwtp code in front of me so this may be wrong and I can't do a PR
Replace line 67 & 68 with:
if (revealContentEvent.getContent() == null) {
presenter.clearSlot((NestedSlot) revealContentEvent.getAssociatedType());
} else {
presenter.setInSlot((NestedSlot) revealContentEvent.getAssociatedType(),
revealContentEvent.getContent());
}
And it should solve the problem.
The PresenterWidget.clearSlot method is very type safe, but this is not yet valid for setInSlot. Mainly, when you try doing
this results in an exception. The main problem IMHO is, that NestedSlot should implement IsRemovable, otherwise the return true in it's isRemovableMethod doesn't make much sense.