JDK-4965768 : (fmt) Formattable.UPPERCASE, etc constant interface antipattern forced on client
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_8
  • CPU: generic
  • Submitted: 2003-12-09
  • Updated: 2003-12-09
  • Resolved: 2003-12-09
Related Reports
Duplicate :  
Relates :  
Description
The interface java.util.Formattable forces its clients (extending interfaces
and implementing classes) to adopt the constant interface antipattern for
LEFT_JUSTIFY, UPPERCASE, and ALTERNATE.  Specifically, these constants become
part of the public API of any class that implements Formattable.

Comments
SUGGESTED FIX Some alternatives: (1) remove the constants and replace the flags parameter of formatTo() with three booleans. (Has the possible disadvantage of preventing a possible future extension of the set of flags) (2) move the constants into Formatter. (3) Use an enum (perhaps named Formatter.Flags) and java.util.Set<Flags>.
11-06-2004

EVALUATION Duplicate. -- iag@sfbay 2003-12-09
09-12-2003