You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2008/01/04 06:08:34 UTC

[jira] Commented: (IO-143) [PATCH] Added Singleton Constants in several stream classes

    [ https://issues.apache.org/jira/browse/IO-143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12555800#action_12555800 ] 

Jukka Zitting commented on IO-143:
----------------------------------

Are these singleton constants really useful to anyone? They save the vanishingly small performance and memory impacts of creating new instances where these classes are used, but the price is increased amount of typing; for example "new ClosedInputStream()" vs. "ClosedInputStream.CLOSED_INPUT_STREAM". IMHO the tradeoff is not worth it.

So -0 on this. I won't object if people want these constants, but to me this smells of premature optimization.


> [PATCH] Added Singleton Constants in several stream classes
> -----------------------------------------------------------
>
>                 Key: IO-143
>                 URL: https://issues.apache.org/jira/browse/IO-143
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Streams/Writers
>         Environment: jvm compliant os
>            Reporter: Nikunj Trivedi
>            Assignee: Niall Pemberton
>             Fix For: 1.4
>
>         Attachments: closed_input_stream.patch, closed_output_stream.patch, null_output_stream.patch, null_writer.patch, singleton.patch
>
>
> I have added singleton constants in following four classes which should have been singleton.
> ClosedInputStream
> ClosedOutputStream
> NullOutputStream
> NullWriter
> We may also make it a singleton by keeping constructor private, if required.
> Please comment/commit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.