You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2024/11/06 11:49:00 UTC
[jira] [Commented] (IO-861) BoundedInputStream is hard to subclass becauase constructors are deprecated
[ https://issues.apache.org/jira/browse/IO-861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17895935#comment-17895935 ]
Gary D. Gregory commented on IO-861:
------------------------------------
Hello [~msqr]
Please post your subclass so I can see if it can be coded differently.
> 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
> Priority: Major
>
> 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)