« Return to Thread: VOTE: setRequired final or not?

Re: VOTE: setRequired final or not?

by Al Maw :: Rate this Message:

Reply to Author | View in Thread

Kent Tong wrote:

> Eelco Hillenius <eelco.hillenius@...> writes:
>
>> Well nevermind. I'm actually ok with doing this in onAttach. I rolled
>> back the change.
>
> For what it's worth, I think having isRequired() returns a value that
> is different from the REQUIRED flag is a serious design flaw. It
> simply means the REQUIRED flag is unused in this case and is there
> only to confuse people.
>
> On the other hand, should setRequired() be forbidden from doing anything
> extra in addition to setting the REQUIRED flag? The answer should be no
> (as shown in the case of FormComponentPanel). Allowing subclasses to do
> something extra does not necessarily violate any contract established.
> The subclass just has to be careful when overriding setRequired(). This
> is always the case when overriding any method.
>
> Granted, there may be existing code that is abusing isRequired() to make
> the thing work. This may be a reason for not introducing the change right
> now, but it shouldn't be reason for not going toward that goal in an
> orderly fashion.

Yeah, I don't like it either.

Can't you have an onSetRequired() callback? Or would that be even nastier?

Al

 « Return to Thread: VOTE: setRequired final or not?