On Mon, Oct 14, 2024 at 9:29 PM Gary D. Gregory <[email protected]> wrote:
>
> Hi All,
>
> We now have append methods like:
>
> public interface HelpAppendable extends Appendable {
>
> /**
> * Appends a header.
> *
> * @param level the level of the header. This is equivalent to the "1",
> "2", or "3" in the HTML "h1", "h2", "h3" tags.
> * @param text the text for the header
> * @throws IOException on write failure
> */
> void appendHeader(int level, CharSequence text) throws IOException;
>
> ...
>
> The supertype defines behavior for null input, but here we do not, we should
> either document it as:
> - Same as the super type, same kind of Javadoc
> - Explicitly document that it is up to the implementing class
>
> Thoughts?
While for the general 'append' I can see the motivation for outputting
'null' for null input. For headers it seems simply invalid to me, and
IMO it'd make more sense to declare all implementations should throw a
NullPointerException in that case.
If we do decide to allow null here, I think we should define the
behavior in a way that all implementations can follow - which the
super type does nicely ('If csq is null, then characters will be
appended as if csq contained the four characters "null".'). I don't
see a strong reason to leave it up to the implementing class - what
would be the use case?
Kind regards,
--
Arnout Engelen
ASF Security Response
Apache Pekko PMC member, ASF Member
NixOS Committer
Independent Open Source consultant
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]