Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6623459
Votes 0
Synopsis Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern
Category java:classes_awt
Reported Against
Release Fixed 7(b27)
State 10-Fix Delivered, request for enhancement
Priority: 4-Low
Related Bugs
Submit Date 30-OCT-2007
Description
Prior to Java 5, there was an ugly approach in using constant values named as Constant Interface Antipattern. To keep constants at one place and make them accessible in different classes of the application, it was a custom to define an interface containing all constants, other classes had to implement the interface wherever those constants were required. 
This approach conflicts with the  customer  orientation of Java language. Such constants are implementation details for a class but if the class accesses them by implementing an interface they become a part of public access (API) of the class. It means implementation details are being linked as API here.
Constant imports could be used as a replacement.
Posted Date : 2007-10-30 08:59:03.0
Work Around
N/A
Evaluation
There are a few places we use this antipattern:
XBaseWindow.java:33:public class XBaseWindow implements XConstants, XUtilConstants {
XContentWindow.java:43:public class XContentWindow extends XWindow implements XConstants XlibWrapper.java:32:public class XlibWrapper implements XConstants, XUtilConstants, XProtocolConstants
The rest places shouldn't be affected by the change.
Posted Date : 2007-10-30 08:59:03.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang