Java Convention Failure

Overview

This page covers java classes which don't follow naming conventions. While there are many of these, some are worth noting IMHO.

Dis-honour roll

Using the same name as a class or interface it extends

Nominations

org.omg.CORBA.Object for extending java.lang.Object (and using the same name)

org.omg.PortableServer.Current and org.org.PortableInertceptor for extending Current in another package (and having a title case package name)

Winner

com.sun.corba.se.spi.orb.ORB extends com.sun.corba.se.org.omg.CORBA.ORB extends org.omg.CORBA_2_3.ORB extends org.omg.CORBA.ORB

Long class names

Nominations

com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl

java.beans.javax_swing_tree_DefaultMutableTreeNode_PersistenceDelegate

Winner

com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState

Error which is not an error

java.rmi.ServerError extends RemoteException extends Exception

org.omg.CORBA.PolicyError extends UserException

Winner

com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError extends Exception

Exception which is not an exception

com.sun.corba.se.impl.logging.ActivationSystemException extends LogWrapperBase (not an Exception)

com.sun.corba.se.impl.io.TypeMismatchException extends Error

Winner

javax.print.FlavorException which is an interface

Confusing mix of case

java.io.Console has a readline(boolean) and readLine()

javax.swing.DebugGraphics has a DebugGraphics constructor and debugGraphics() method

com.sun.corba.se.impl.naming.pcosnaming.NamingContextImpl has methods bind and Bind, unbind and Unbind, resolve and Resolve, destroy and Destroy, list and List

javax.swing.tree.DefaultTreeCellEditor.EditorContainer has both a constructor EditorContainer() and a method void EditorContainer() Apparently this was fixed in Java 1.2.2 on 1999-02-01 but its still there.

Winner

com.sun.org.apache.bcel.internal.Constants.ArrayType which implement equals and hashcode but NOT hashCode()

Odd variable names

BasicLookAndFeel with the local variable

Integer four = new Integer(4);

DecimalFormat with the Exception named foo

} catch (Exception foo) {
   // should never happen
}

KeyIndex with a dummy argument for its constructor

public KeyIndex(int dummy) {
}
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.