JDK-6184334 : Massive duplication of code in contains(Charset) methods in UTF-* Charsets
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio.charsets
  • Affected Version: 6
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2004-10-26
  • Updated: 2010-04-02
Description
All of the Unicode-encoding Charsets such as UTF-8 and UTF-16
have a boolean contains(Charset) method that enumerates all
the other charsets.

This is obviously a maintenance problem.  This method should,
at the very least, be refactored.  The enumerated list of
other charsets is likely to be incorrect.  It would be correct
to return true for any Charset that we currently implement, and
it is hard to imagine a Charset for which it would not be true
that, say, UTF-16 contains it.  Perhaps we should simply return true.
###@###.### 10/26/04 02:26 GMT

Comments
EVALUATION yes ###@###.### 10/26/04 02:42 GMT See #6230124. We have already fixed the "duplication of code" problem in that bug. Keep this one alive in case we can agree to simply just return "true" for utf-x charsets instead of current enumerating.
26-10-2004