You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Matt Magoffin (Jira)" <ji...@apache.org> on 2024/11/06 05:00:00 UTC

[jira] [Created] (IO-861) BoundedInputStream is hard to subclass becauase constructors are deprecated

Matt Magoffin created IO-861:
--------------------------------

             Summary: BoundedInputStream is hard to subclass becauase constructors are deprecated
                 Key: IO-861
                 URL: https://issues.apache.org/jira/browse/IO-861
             Project: Commons IO
          Issue Type: Improvement
          Components: Streams/Writers
    Affects Versions: 2.17.0
            Reporter: Matt Magoffin


The {{org.apache.commons.io.input.BoundedInputStream}} class added a {{Builder}} in version 2.16 (I think), and also annotated all public constructors with {{{}@Deprecated{}}}. I have classes that extend {{BoundedInputStream}} < 2.16 that make use of those constructors, and I'd like to avoid using deprecated code in version 2.17. I do not see any other way to sub-class {{{}BoundedInputStream{}}}, however.

The purpose of my subclass is to override the provided {{onMaxLength}} method:
{code:java}
protected void onMaxLength(final long maxLength, final long count) throws IOException {
    // for subclasses
}
{code}
method, which has been specifically designed for sub-classes like mine to override. Would it be possible to remove the deprecation on at least one constructor, or is there some other way I'm missing?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)