Brandon DeVries created NIFI-3073:
-------------------------------------
Summary: poorly named nifi clones of standard java classes
Key: NIFI-3073
URL: https://issues.apache.org/jira/browse/NIFI-3073
Project: Apache NiFi
Issue Type: Improvement
Reporter: Brandon DeVries
Priority: Minor
Fix For: 1.1.0, 0.7.1
org.apache.nifi.stream.io.DataOutputStream is a clone of
java.io.DataOutputStream that *does not* do synchronization. This should have
a different name, indicating this. Overloading the name invites confusion.
The comment in the class\[1] should also be corrected to accurately reflect its
intent:
{quote}
This class is different from java.io.DataOutputStream in that it does
synchronize on its methods.
{quote}
The incorrect comment should further illustrate the point on confusion, in that
both the name and comment imply behavior potentially much different than the
actual.
Implementation note... previously there were concerns about backwards
compatibility should this method be removed. This can be avoided by renaming
this class, and creating a new org.apache.nifi.stream.io.DataOutputStream that
is marked as deprecated and simply extends the properly named class without
modification. org.apache.nifi.stream.io.DataOutputStream can then be removed
in a future release. This would also have the benefit of highlighting for
developers any instances where this class was mistakenly used.
It would likely be wise to examine the code base for further instances of this
(anti-)pattern.
\[1]
https://github.com/apache/nifi/blob/d838f61291d2582592754a37314911b701c6891b/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/DataOutputStream.java#L26
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)