robtimus commented on a change in pull request #173:
URL: https://github.com/apache/commons-io/pull/173#discussion_r538752019



##########
File path: src/main/java/org/apache/commons/io/input/CloseShieldInputStream.java
##########
@@ -35,7 +35,11 @@
      * closed.
      *
      * @param in underlying input stream
+     * @deprecated Using this constructor prevents IDEs from warning if
+     *             the underlying input stream is never closed.
+     *             Use {@link #wrap(InputStream)} instead.
      */
+    @Deprecated

Review comment:
       I feel that without deprecating the constructors, this PR adds no real 
value. People that currently use the constructors will keep doing so because 
they see no reason to change their code, and new users of the classes may only 
get confused if there are two ways to do the same thing. They'll probably end 
up using the constructors too because that's a character shorter (`new` vs 
`.wrap`).
   
   My thought was that deprecating the constructors will make current users 
think about whether or not they have closed the underlying streams, even if 
their IDEs don't warn them. New users will chose the wrapper method because the 
alternative is deprecated.
   
   The only downside to deprecating the constructors that I can see is that 
current users that don't have their IDEs setup to warn about unclosed streams 
will get warnings where there were none first, but as I said, perhaps they will 
think about whether or not their streams are properly closed somewhere else.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to