Summary
-------
Add explicit constructors to some classes in Java AWT APIs which using default constructors.
Problem
-------
Default constructors are not recommended for formal API classes.
Solution
--------
Add the public constructors to the public/non-abstract classes, and protected constructors to the public/abstract classes.
Specification
-------------
src/java.desktop/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java
+ /**
+ * Constructs a {@code ContainerOrderFocusTraversalPolicy}.
+ */
+ public ContainerOrderFocusTraversalPolicy() {}
src/java.desktop/share/classes/java/awt/DefaultFocusTraversalPolicy.java
+ /**
+ * Constructs a {@code DefaultFocusTraversalPolicy}.
+ */
+ public DefaultFocusTraversalPolicy() {}
src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java
+ /**
+ * Constructs a {@code DefaultKeyboardFocusManager}.
+ */
+ public DefaultKeyboardFocusManager() {}
src/java.desktop/share/classes/java/awt/FocusTraversalPolicy.java
public abstract class FocusTraversalPolicy {
+ /**
+ * Constructs a {@code FocusTraversalPolicy}.
+ */
+ protected FocusTraversalPolicy() {}
src/java.desktop/share/classes/java/awt/Toolkit.java
public abstract class Toolkit {
+ /**
+ * Constructs a {@code Toolkit}.
+ */
+ protected Toolkit() {}
src/java.desktop/share/classes/java/awt/dnd/DragSourceAdapter.java
implements DragSourceListener, DragSourceMotionListener {
+ /**
+ * Constructs a {@code DragSourceAdapter}.
+ */
+ protected DragSourceAdapter() {}
src/java.desktop/share/classes/java/awt/dnd/DropTargetAdapter.java
public abstract class DropTargetAdapter implements DropTargetListener {
+ /**
+ * Constructs a {@code DropTargetAdapter}.
+ */
+ protected DropTargetAdapter() {}
src/java.desktop/share/classes/java/awt/event/ComponentAdapter.java
public abstract class ComponentAdapter implements ComponentListener {
+
+ /**
+ * Constructs a {@code ComponentAdapter}.
+ */
+ protected ComponentAdapter() {}
src/java.desktop/share/classes/java/awt/event/ContainerAdapter.java
public abstract class ContainerAdapter implements ContainerListener {
+
+ /**
+ * Constructs a {@code ContainerAdapter}.
+ */
+ protected ContainerAdapter() {}
src/java.desktop/share/classes/java/awt/event/FocusAdapter.java
public abstract class FocusAdapter implements FocusListener {
+
+ /**
+ * Constructs a {@code FocusAdapter}.
+ */
+ protected FocusAdapter() {}
src/java.desktop/share/classes/java/awt/event/HierarchyBoundsAdapter.java
public abstract class HierarchyBoundsAdapter implements HierarchyBoundsListener
{
+ /**
+ * Constructs a {@code HierarchyBoundsAdapter}.
+ */
+ protected HierarchyBoundsAdapter() {}
src/java.desktop/share/classes/java/awt/event/KeyAdapter.java
public abstract class KeyAdapter implements KeyListener {
+
+ /**
+ * Constructs a {@code KeyAdapter}.
+ */
+ protected KeyAdapter() {}
src/java.desktop/share/classes/java/awt/event/MouseAdapter.java
public abstract class MouseAdapter implements MouseListener, MouseWheelListener, MouseMotionListener {
+
+ /**
+ * Constructs a {@code MouseAdapter}.
+ */
+ protected MouseAdapter() {}
src/java.desktop/share/classes/java/awt/event/MouseMotionAdapter.java
public abstract class MouseMotionAdapter implements MouseMotionListener {
+
+ /**
+ * Constructs a {@code MouseMotionAdapter}.
+ */
+ protected MouseMotionAdapter() {}
src/java.desktop/share/classes/java/awt/event/WindowAdapter.java
public abstract class WindowAdapter implements WindowListener, WindowStateListener, WindowFocusListener
{
+ /**
+ * Constructs a {@code WindowAdapter}.
+ */
+ protected WindowAdapter() {}
Link for convenience: http://cr.openjdk.java.net/~serb/8250856/webrev.00